Prev: How to get repeatable Excel RAND sequence?
Next: How do I copying data from a cell on sheet to a diff cell/sheet
From: Ephraim on 21 Mar 2010 09:33 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
From: Don Guillett on 21 Mar 2010 09:50 -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett(a)gmail.com "Ephraim" <rick.malone(a)gmail.com> wrote in message news:1384d8a2-d6b3-4fde-966c-b272a9507e08(a)c16g2000yqd.googlegroups.com... > 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
From: Don Guillett on 21 Mar 2010 09:52
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 dguillett(a)gmail.com "Ephraim" <rick.malone(a)gmail.com> wrote in message news:1384d8a2-d6b3-4fde-966c-b272a9507e08(a)c16g2000yqd.googlegroups.com... > 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 |