ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning Macro to "Buttons" (https://www.excelbanter.com/excel-programming/300890-assigning-macro-buttons.html)

grin2000[_5_]

Assigning Macro to "Buttons"
 
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
--
Message posted from http://www.ExcelForum.com


Don Guillett[_4_]

Assigning Macro to "Buttons"
 
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.

--
Don Guillett
SalesAid Software

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

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

Attachment filename: buttons.xls
Download attachment:

http://www.excelforum.com/attachment.php?postid=571293
---
Message posted from http://www.ExcelForum.com/




Bob Phillips[_6_]

Assigning Macro to "Buttons"
 
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)

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

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

Attachment filename: buttons.xls
Download attachment:

http://www.excelforum.com/attachment.php?postid=571293
---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com