A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combine macros variable help



 
 
Thread Tools Display Modes
  #1  
Old March 21st, 2010, 02:33 PM posted to microsoft.public.excel.worksheet.functions
Ephraim
external usenet poster
 
Posts: 15
Default Combine macros variable help

So I've recorded a number of macros that each hide a different Week.

Sub Macro1()
' Macro1 Macro
Application.Goto Reference:="Week1"
Selection.EntireColumn.Hidden = True
End Sub
..
..
..
Sub Macro10()
' Macro10 Macro
Application.Goto Reference:="Week10"
Selection.EntireColumn.Hidden = True
End Sub

How do I create one macro to do all of this by using a variable for
the "Week number" that is provided by asking the user to select the
Week number from an input box or a drop down list?
Thanks
  #3  
Old March 21st, 2010, 02:52 PM posted to microsoft.public.excel.worksheet.functions
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default Combine macros variable help

Sub hidecolumn()
'Columns.Hidden = False'uncomment to unhide all first
cth = InputBox("Enter week number ie: 1 10")
mycol = "week" & cth
Range(mycol).EntireColumn.Hidden = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ephraim" wrote in message
...
So I've recorded a number of macros that each hide a different Week.

Sub Macro1()
' Macro1 Macro
Application.Goto Reference:="Week1"
Selection.EntireColumn.Hidden = True
End Sub
.
.
.
Sub Macro10()
' Macro10 Macro
Application.Goto Reference:="Week10"
Selection.EntireColumn.Hidden = True
End Sub

How do I create one macro to do all of this by using a variable for
the "Week number" that is provided by asking the user to select the
Week number from an input box or a drop down list?
Thanks


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.