Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how can a create a print command button in excel

I would like to create a command button in excel on the worksheet to print a
portion of the worksheet and/or graphs at the bottom of the worksheet. Can
this be done in Excel and how much VBA programming is involved?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default how can a create a print command button in excel

Yes it can be done, and you can record the macro - then use the forms
toolbar (for preference on this one) to get a button onto the worksheet
and then assign your macro to it.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how can a create a print command button in excel

Thank you. I have data on the top half of my worksheet and graphs on the
bottom. I would like to have the user click a button and have the option to
print just the data on the top of the worksheet or the graphs at the bottom
of the worksheet. Am I making this to difficult on myself.

" wrote:

Yes it can be done, and you can record the macro - then use the forms
toolbar (for preference on this one) to get a button onto the worksheet
and then assign your macro to it.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default how can a create a print command button in excel

No not at all - you can still record the two halves of the macro, but
you will then need to put them together

ending up with something like

sub printme
n=msgbox("Print data(yes/no)",vbyesno)
if n=vbno then
'do the print bottom of the area macro
else
'do the print top of the area macro
end if

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how can a create a print command button in excel

I have really recorded any macros in excel. This definitely is my problem.
It asks me to record the macro but I do not know how to get a simple print
command into the macro. If I knew how to do this then I believe I'd be able
to figure out the top and bottom printing. Can you help me with creating a
print page/worksheet macro

" wrote:

No not at all - you can still record the two halves of the macro, but
you will then need to put them together

ending up with something like

sub printme
n=msgbox("Print data(yes/no)",vbyesno)
if n=vbno then
'do the print bottom of the area macro
else
'do the print top of the area macro
end if




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default how can a create a print command button in excel

Tools, macro, record new macro

Now carry out the actions you want to carry out (set print area, print
workbook)

then stop the recorder

You will end up with a macro SOMETHING like this

ActiveSheet.PageSetup.PrintArea = "$A$404:$D$413"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how can a create a print command button in excel

I am sorry I have not recorded any macros in Excel (type error). Am I to
highlight the area to be printed and save it as a macro? How does the macro
creation work?

"velcrowe11" wrote:

I have really recorded any macros in excel. This definitely is my problem.
It asks me to record the macro but I do not know how to get a simple print
command into the macro. If I knew how to do this then I believe I'd be able
to figure out the top and bottom printing. Can you help me with creating a
print page/worksheet macro

" wrote:

No not at all - you can still record the two halves of the macro, but
you will then need to put them together

ending up with something like

sub printme
n=msgbox("Print data(yes/no)",vbyesno)
if n=vbno then
'do the print bottom of the area macro
else
'do the print top of the area macro
end if


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how can a create a print command button in excel


Sub Button4_Click()
'Print Forms
Application.ScreenUpdating = False
If ActiveSheet.Name = "Sheet1" Then_
Rows("x:y").Hidden = True 'x & y are a range of row numbers to hide.
ie They will not appear in the printout.
Else
End If
Sheet1.PageSetup.PrintArea = "a:b" 'Sets the Print area. a = top left
most cell, b = bottom right most cell
ActiveSheet.PrintOut 'Prints the Print area
Sheet1.PageSetup.PrintArea = "" 'Clears the Print area
Else
End If
Application.ScreenUpdating = True
End Sub

Does this help at all.

You should be able to adapt the above to print the top half or bottom
half of your spreadsheet.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=541549

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how can a create a print command button in excel


1) Right click on the unused part of your toolbar at the top of your
spreadsheet
and select Forms.
2 ) You will now see a Forms toolbar.
3) Click on the Button icon. (rectangular grey box).
4) Your mouse cursor on your spreadsheet will now turn to a cross.
5) Hold your mouse button down and drag it to form the button to the
size you want & then release.
6) When you release an 'Assign Macro' window will be displayed.
7) Click on 'New'.
This will take you to the Properties window where you will see two
commands already there.
They will be a Sub Button header which will be the name it has called
the macro button you have just generated, and an End Sub command.
Your print macro needs to be imbedded between these two commands.
If you leave off the 1st and last line of the program I sent you and
paste the rest between your two commands.
Your program should now begin with a Sub Button () looking command and
end with an End Sub.

What you need to do now is tailor my program to hide the cell range
that you dont want to print, and enter the cell range that you do want
to print.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=541549

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a command button, then assign macro to it in excel kshaheen Excel Discussion (Misc queries) 3 June 24th 08 01:03 PM
Create command button to print multiple worksheets in a excel file MarcoR Excel Discussion (Misc queries) 3 June 26th 06 07:07 PM
command button in excel will move when print. [email protected] Excel Discussion (Misc queries) 1 December 29th 04 03:53 PM
How do I setup a print command button in excel 2003 BigPunchy New Users to Excel 1 December 24th 04 11:54 PM
Why the command button in excel will move when print. TSH Excel Programming 1 November 24th 04 05:54 AM


All times are GMT +1. The time now is 04:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"