Printing a Sheet

  • Thread starter Thread starter Lord Of The Morning
  • Start date Start date
L

Lord Of The Morning

How about something a little easier is it possible to create a button on a
excel sheet that when clicked will print the current sheet?

Nick
 
Yes.

Go to "View", "Toolbars" and switch on the "Forms" tool bar. Insert a button
on your spreadsheet from the "Forms" toolbar.

Create a macro that prints whatever it is you want to print.

Right click the button you inserted onto your spreadsheet and go to "Assign
Macro". Assign the macro you have just created.
 
Cool, do you know where I can learn more about Macros?
I really don't know how to create one lol.

Nick
 
Use this code,
Sub Print_This_Sheet()
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub
To put in a Macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is to the left of the "File" menu this will open
the VBA editor, in the left hand window click on your workbook name, go to
insert, module, and paste the code in the window that opens on the right
hand side, press Alt and Q to close this window and go back to your workbook
and press alt and F8, this will bring up a box to pick the Macro from, click
on the Macro name to run it, or in your case assigne it to the button. If
you are using excel 2000 or newer you may have to change the macro security
settings to get the macro to run.

--
Paul B
Always backup your data before trying something new
Using Excel 2000 & 97
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Got this out of Excel help, follow it through and you will be fine.


Record a macro

1 On the Tools menu, point to Macro, and then click Record.

2 In the Macro name box, enter a name for the macro.

The first character of the macro name must be a letter. Other characters can
be letters, numbers, or underscore characters. Spaces are not allowed in a
macro name; an underscore character works well as a word separator.

3 To run the macro by pressing a keyboard shortcut key, enter a letter in
the Shortcut key box. You can use CTRL+ letter (for lowercase letters) or
CTRL+SHIFT+ letter (for uppercase letters), where letter is any letter key
on the keyboard. The shortcut key letter you use cannot be a number or
special character. The shortcut key will override any default Microsoft
Excel shortcut keys while the workbook that contains the macro is open.

4 In the Store macro in box, click the location where you want to store the
macro.

If you want a macro to be available whenever you use Microsoft Excel, store
the macro in the Personal Macro Workbook in the XLStart folder.
To include a description of the macro, type the description in the
Description box.

5 Click OK.

If you select cells while running a macro, the macro will select the same
cells regardless of which cell is first selected because it records absolute
cell references. If you want a macro to select cells regardless of the
position of the active cell when you run the macro, set the macro recorder
to record relative cell references. On the Stop Recording toolbar, click
Relative Reference . Microsoft Excel will continue to record macros with
relative references until you quit Microsoft Excel or until you click
Relative Reference
again.

6 Carry out the actions you want to record.

7 On the Stop Recording toolbar, click Stop Recording .

Tip If you want a macro to select a specific cell, perform an action, and
then select another cell relative to the active cell, you can mix the use of
relative and absolute references when you record the macro. To record a
macro by using relative references, make sure that Relative Reference is
pressed in. To record with absolute references, make sure Relative Reference
is not pressed in.
 
Thanks Paul im playing around with that now, if I wanted to print another
sheet in my workbook
do I just tell it to print sheet 6?
 
try this,
Sub Print_This_Sheet()
'using sheet tab name
Sheets("sheet6").PrintOut Copies:=1, Collate:=True
End Sub

Sub Print_This_Sheet()
'using VBA sheet name
Sheet6.PrintOut Copies:=1, Collate:=True
End Sub


--
Paul B
Always backup your data before trying something new
Using Excel 2000 & 97
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Back
Top