Assigning Macro to "Buttons"

G

grin2000

Attached is the sheet I'm working on. The 4 buttons above each of the
years and the sum need a specific macro that when you click on th
button, for example Yr1, it will take you to the other colums whic
contain the more detailed 12 months of that year.
When it takes you to those 12 months the only thing thing I would lik
to be seen is those 12 months (along with that year's summary which i
next to the last month of that year) on the screen. So that if someon
wants to print anything all they they would have printed is only what'
on the screen.
For the last button which is the 3yr Sum I just want it to show th
original yr1, yr2, yr3 and 3yr sum colums when clicked on.(again onl
those 4 colums I would like to show in the screen for viewing an
printing purposes) Thanks, I appreciate it.

BTW....... all of the detailed months colums will be hidden the onl
colums that will be unhidden are the 4 colums with the buttons abov
them

Attachment filename: buttons.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=57129
 
D

Don Guillett

I think I would arrange my data somewhat differently but you can do this
yourself by recording a macro while you hide/unhide the pertinent columns.
 
B

Bob Phillips

Here is 4 macros, just assign to the buttons


Sub yr1Macro()
Columns("H:T").Hidden = False
Columns("U:AG").Hidden = True
Columns("AH:AT").Hidden = True
End Sub


Sub yr2Macro()
Columns("H:T").Hidden = True
Columns("U:AG").Hidden = False
Columns("AH:AT").Hidden = True
End Sub


Sub yr3Macro()
Columns("H:T").Hidden = True
Columns("U:AG").Hidden = True
Columns("AH:AT").Hidden = False
End Sub


Sub yr3SummaryMacro()
Columns("H:T").Hidden = True
Columns("U:AG").Hidden = True
Columns("AH:AT").Hidden = True
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top