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?
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?
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.
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.
"[email protected]" 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.
>
>
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
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
"[email protected]" 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
>
>
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
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
>
> "[email protected]" 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
> >
> >
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks