Hiding Columns
Sub HideColumns()
Range("A1").Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value = 2 Then
Selection.EntireColumn.Hidden = True
End If
ActiveCell.Offset(ColumnOffset:=1).Activate
Loop
Range("A1").Select
End Sub
HTH
RC-
"Andy the yeti" wrote in message
...
Is there a piece of VBA code that will allow me to run a macro at a push
of a
button that will hide or unhide columns in a workbook dependant on a given
criteria in say row A ?
For example if columns A, B, C & F, & H has a "1" in then leave and if
columns D, E, & G has a "2" then 'hide' ?
Many thanks
Andy
|