How do I put a button on an excel spreadsheet to print a report?

Hi please help
I want to put a button onto a excel spreadsheet (not the toolbar) that will 
print a report for me from another sheet, what macro do I use and what 
options do I use
Casper (17)
7/27/2005 11:55:01 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 21

I would record a macro when I printed what I wanted.

Then I'd use a button from the Forms toolbar and plop it onto that other
sheet--and assign that recorded macro to that button.

Your recorded macro may look something like:

Option Explicit
Sub Macro1()
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I'd change it to be more specific (and give it a nice name):

Option Explicit
Sub PrintSheet1()
    worksheets("sheet1").PrintOut Copies:=1, Collate:=True
End Sub

Casper wrote:
> Hi please help
> I want to put a button onto a excel spreadsheet (not the toolbar) that will
> print a report for me from another sheet, what macro do I use and what
> options do I use
> Regards
> Casper


Dave Peterson
petersod (12004)
7/28/2005 2:16:00 AM
Hi Casper,

Try going to design mode in your toolbar and clicking on the comman
button icon place it on the sheet desired then right click the button
click view code and try placing the code below.

I set this up as sheet 2 being the one printed, change as needed. Th
same will go for the print range.

  Sub CommandButton1_Click()
  Application.ScreenUpdating = False
  Sheets("sheet2").Visible = True
  ActiveSheet.PageSetup.PrintArea = "$A$1:$I$508"
  ActiveWindow.SelectedSheets.PrintOut copies:=1, collate:=True
  Sheets("sheet2").Visible = True
  Application.ScreenUpdating = True
  End Sub

Hope this help

keithl816's Profile:
View this thread:

7/28/2005 2:21:57 AM

Similar Artilces:

Option Buttons on a spreadsheet
Is there a limit to the number of option buttons I can insert into a group. If I am using the cell link and then creating an IF formula based on the result does this have an impact? Thank you in advance. Kind regards Ann, Dublin, Ireland There may be but, if so, it would be a large number that none of us have run into. I'd guess that you would achieve an ungainly and awkward interface well before you hit any limit. -- Jim "Ann Shaw" <> wrote in message news:047e01c54b29$7d2fe3c0$a401280a@phx.gbl... > Is there a limit to the number of opti...

format of excel file to be counted as Table for Access
While importing external data, there is an option of importing an excel file in the form of a Table. Though a table in Access also has headings & data below it, what does the utility expect an excel file to contain? Thanks ...

Excel application keeps growing #2
I did check where the CTRL/END takes me and it takes me to the end of m data. So that is OK. I am also saving it as Microsoft Excel Workbook (*.xls). It i possible that sometime over the past couple of years someone has save it under multiple excel versions 95, 97, etc. and I read where tha could double the size of the document. Is there a way to check to se if that might be the problem and if it saved under different version can I change that to only save it under my version, 2000? Thanks, Crai -- cparson ----------------------------------------------------------------------- cparsons...

ActiveX controls and printing
I’m using a form with an ActiveX control (Autodesk’s DWG TrueView) to view AutoCAD drawings. I can print the drawings directly from my database by right clicking on the ActiveX control, then selecting File – Plot. This opens TrueView’s “print dialog” (not sure if that’s the correct term) so that I can select the printer, paper size, and plot area. Is there a way to automate this so I can just click a command button? If someone could point me in the right direction I’d really appreciate it. Thanks. Your control exposes a method, probably named Plot. You can easily see what Methods ...

Excel on the Web #2
I need to put an excel file out on the web. After saving it in the HTML format what would be my next step. Thanks Frank ...

I AM TRYING TO ENTER A NUMBER THAT BEGINS WITH ZERO'S AFTER I ENTER IT THE ZERO'S DISAPPEAR, HOW DO I KEEP THEM IN Please turn off the CAPS Lock, more than two lines would be extremely difficult to read. Reading caps is annoying. Format the column as text, if the leading zero is important to you then it is an identification not a number. The default alignment for text is left aligned which is also better for most identification "numbers". Credit card numbers are 16 digits, are identification and can not be entered as numbers, ever, because Excel only retains 15 si...

# value in spreadsheet
When i copy spreadsheets and build a master worksheet # value shows up in any cell that doesn't have a number or zero in it. I know there is a way to fix this but can't seem to find it---can anyone help? Does the cell just turn to #value! Or is it the result of a formula? If it's a formula that's being copied, what's the formula? ron cooley wrote: > > When i copy spreadsheets and build a master worksheet # > value shows up in any cell that doesn't have a number or > zero in it. I know there is a way to fix this but can't > seem to find it-...

MySQL ODBC to Excel
Afternoon all, Having searched seemingly everywhere i think i can guess the answer i am going to get - but here goes... Using the MySQL ODBC client I can pull data from my database into Excel. Is it then possible for me to directly edit this data from Excel into the database - this is "possible" from within Access. Thanks Richard On Wed, 18 Feb 2009 08:40:31 -0800 (PST), rjre <> wrote: >Having searched seemingly everywhere i think i can guess the answer i >am going to get - but here goes... > >Using the MySQL ODBC client I can pull dat...

Shared Spread sheet(Excel 97)
Some users have reported Excel locking up when they open a specific spread sheet, and others have no problem. If anyone has any ideas it would be appreciated Thank ...

Restricting activation of a form button
I'm using 2 form buttons which runs 2 different subs. The buttons are on the same sheet. I wish to restrict the activation of one of the 2 buttons (assigned to the sub below) to only authorised persons via say, a password prompt? which appears upon clicking the button. Grateful for an example or two of how this control could be done. Thanks Sub TestReset() Sheet8.Select Range("D10").Value = Range("G15").Value Range("D11").Value = Range("D15").Value End Sub I would try something like this: Sub TestRest() Sheet8.Select Dim...

Set Print Preview to always show color
It was easy enough to get Publisher 2003 to perform a print preview in black and white using Tools, Commercial Printing Tools. I want to set it back to print preview in color but it refuses to do so. I have jacked around with all of the radio buttons for Any Color, Single color, Process Colors, etc. but nothing seems to work. If anyone can help me out, please do so. -- Thanks Wes Newman How about the printer settings? Are they set to color? The Generic Color Postscript for Commercial Printing has a color choice in the preferences. Paper/Quality tab. Have you checked the printer pre...

EXCEL 2002 #3
CAN'T OPEN FILES IN SUBFOLDER - ERROR MESSAGE 1. CAN'T FILE FILE 2. DDE ERROR WHEN WORKSHEET MOVED OUT OF FILE TO ANOTHER FOLDER IT CAN BE OPENED. OR IF MOVED TO DISK IT CAN BE OPENED ANY SUGGESTIONS? Sometimes one of these works: Close Excel and Windows Start Button|Run excel /unregserver then Windows Start Button|Run excel /regserver The /unregserver & /regserver stuff resets the windows registry to excel's factory defaults. An alternative might be to do: Try Tools|Options|General|Ignore other applications (uncheck it) "J. SMITH" wrote: > > ...

Can you put white space outside a textbox?
When I put pictures in my publisher file, sometimes I want captions for the pictures. So I make a tiny textbox that I put under the picture, and type in a caption into that textbox. The problem is that I can make the picture have some space to left and right of it so that text doesn't crowd into the picture, but I can't do that with the textbox containing the caption. Is there any way to prevent outside text from crowding the borders of a textbox? You can move that textbox wherever you need. You don't need to leave space inside when you can steer clear of the textbox itself. ...

Where to put SQL statements in VC++ Application
I am wondering if putting all my SQL statements in the string table is a good idea. Is there a better place to store these statements?? Thanks in advance for any responses. Dominic Inline in the code, they arnt particually helpful to put in the string table. -- - Mark Randall "Those people that think they know everything are a great annoyance to those of us who do" Isaac Asimov <> wrote in message >I am wondering if putting all my SQL statements in...

Calendar in Excel
Can someone help me with a calendar to use in Excel that can be formatted so as to show special dates, current holidays, etc. WARNING: I need explicit instructions. This sort of stuff is not intuitive to me. Thanks, Dot ...

Credit Card Charges and Expense Reports
I purchase pretty much everything on my credit card (for the miles) and pay it off every month. I use the categories within the credit card accounts to specify what the expense was for. But when I look at the expense report, it lumps all CC expenses into the CC category. I want to know what I'm spending my money on, not how it's being paid for. How do I split the items into their proper categories on the reports? Thanks! So many questions, so little time. What version/edition of Money? If M05/6/7/+ are you using Advanced Register or Essential Register? Advanced Reports or Es...

Put app and icon in task bar?
I have an MFC application that I want to be able to put in the task bar as a small icon and have it pop up the dialog when selected from the task bar. This app is intended to be run from the start up menu and be minimized in the task bar along with all the other start items... Pointers on how to please... By default app goes on the task bar. Do you mean system tray (that by default appears on the bottom right of the screen)? -- Ajay Kalra [MVP - VC++] "ShipHead" <> wrote in message news:#g1K8UgEFHA.2700@TK2MSFTNGP14.phx.gbl... > I...

How do I fit a line on an excel plot to a portion of the data?
I want a best fit line to go pass through the obviously linear portion of the data and ignore all other points, how do i do this? Hi, Trend lines are based on all the data points in a series. To get a trend line on a subset of data you will need to add a new series based on only that subset. Cheers Andy -- Andy Pope, Microsoft MVP - Excel "mechengstudent" <> wrote in message >I want a best fit line to go pass through the obviously linear portion...

DCdiag reported test failures. What next? Hpw to fix them?
I ran this on our two domain controllers. Several test failures. Can anyone help figure out how to fix these errors? ................................................................................... DCdiag Test Run On Domain Controller CGDC1 from TCGNS2K3 /c switch is for comprehensive test /s: <domain controller> names the target DC for the test C:\Program Files\Resource Kit>dcdiag /c /s:cgdc1 Domain Controller Diagnosis Performing initial setup: Done gathering initial info. Doing initial required tests Testing server: Default-First-Site-Name\CGDC1 Starting test...

excel changes date
When I enter 3/1/10 enter a cell formatted number, date, 3/14/01, it changes it to 1/3/10. But if I enter 3/19/10 in the same cell it leaves it alone. It is only on one pc, if I open the same file from a different pc the date works fine. Any ideas. Thanks I can not really follow your question but XL inherits it's date entry from your computers regional settings. Take a look at Start | Control Panel | Regional and Language Settings To get your computers date settings. -- HTH... Jim Thomlinson "sue gray" wrote: > When I enter 3/1/10 ent...

Opening different Excel files in new windows
How can I make Excel open different files in completely new windows? Thats how it was working sometime back. Somehow, now everytime I open a new file, it opens in the same Excel window. Is there some setting in Options/Tools that would allow me to do this? Open the first file normally. For a second window open anothe application then the file. : -- Message posted from Just a guess here. I had a similar problem when starting to use Windows XP. XP 'helpfully' lumped all my excel session under one taskbar list. To change it I had to adjust the setting in X...

outlook ka-put
After I installed the service pack updates for Microsoft XP, my Outlook has been uable to send or receive any email. I have gotten a few error messages: "unable to connect to network," "server found but did not respond." etc. What the heck do I do? ...

Excel 97 and Excel XP file
I am trying to open the workbook of an Excel XP file in Excel 97 but get the following message: "Project unviewable in Excel 97" "pcw" wrote > I am trying to open the workbook of an Excel XP file > in Excel 97 but get the following message: > > "Project unviewable in Excel 97" That makes sense. When they released Excel 97 they'd never even heard of Excel XP. You can be backward compatible but it's pretty hard to be forward compatible. Jordon Is it possible to then to save my Excel XP file in a lower version, for example, Excel 97/97...

Excel 2000 Sorting
I have a column that has a mixtoure of numbers and number/letter combinations. eg. 1 2 3 4 4a 5 6 7 8 9 10 11 When i sort it, this is the order i want. However, if I format the cells as numeric, the 4a appears as the last entry. If I format as text, the cells are sorted as follows, for obvious reasons : 1 10 11 2 3 4 4a 5 6 7 8 9 I don't expect there is a solution but if you do have any ideas, I would be grateful ...

Refresh Button
Hi, Can you anyone point me in the right direction? (I am not an expert btw!). I have an excel spreadsheet that extracts information from an SQL database. I want to create a button that can refresh the data on click (I don't want to use the standard one) Any ideas? Thanks, Gary -- judge ------------------------------------------------------------------------ judge's Profile: View this thread: ...