Discussion Locked

excel print macro

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am lost, and I have searched everywhere. This is what I would like. I would like a main page in Excel with a number of buttons. Each button when clicked on should print a respective sheet in the workbook. I know how to do a macro in access but no in excel. Totally lost. Please help.

5 replies

by cptomlly

Create your command buttons one sheet1, then right-click the button and select View Code. Your Click event should look like this

Private Sub CommandButton1_Click()
Sheets("Sheet2").Select
ActiveSheet.PrintOut
Sheets("Sheet1").Select
End Sub

This will select Sheet2, print it, and then return to sheet1. You will then just change the Sheet# as needed for each button.

Hope this helps.

by dklippert

A "Macro" in Access Is:
..."a set of one or more actions that each perform a particular operation, such as opening a form or printing a report. Macros can help you to automate common tasks. For example, you can run a macro that prints a report when a user clicks a command button."
What Access calls a Module is a VBA macro to the rest of the Office world. Access was going to dump the pre-canned "macros" a few versions ago, but it hangs on.
Excel allows you to use Tools>Macro> record a Newmacro to copy your actions for replay.
Later you can look at the code and see how VBA works.

This discussion is closed to new replies.