I am attempting to create a Macro that will look at cell I3 and if it = "GBP" then it will do the following
Sub HideColumns()
'
' HideColumns Macro
' Macro recorded 9/16/2010 by dmau
'
'
Range("E:E,G:G,L:L,N:N,P:P").Select
Range("P1").Activate
Selection.EntireColumn.Hidden = True
Selection.AutoFilter Field:=21, Criteria1:="<>0", Operator:=xlAnd
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Selection.AutoFilter Field:=2, Criteria1:="<>0", Operator:=xlAnd
End Sub
and if I3 = "USD" then
Sub USDHide()
'
' USDHide Macro
' Macro recorded 9/16/2010 by dmau
'
'
ActiveWindow.SmallScroll ToRight:=3
Range("F:F,H:H,M:M").Select
Range("M1").Activate
ActiveWindow.SmallScroll ToRight:=2
Range("F:F,H:H,M:M,O:O,Q:Q").Select
Range("Q1").Activate
Selection.EntireColumn.Hidden = True
Selection.AutoFilter Field:=21, Criteria1:="<>0", Operator:=xlAnd
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Selection.AutoFilter Field:=2, Criteria1:="<>0", Operator:=xlAnd
End Sub
and if blank it don't do anything
I will admit I used the "Record Macro" to obtain the code shown above. I am unsure how to insert the criteria so that the autofilter macro knows to look to cell I3 and based on whether it is USD or GBP will perform the appropriate macro.
I have gone thru what I believed were similar posts and can't seem to get past this part. Macro Newbie here but learning everyday! I'm sure I'm close just not close enough
Bookmarks