Hide colum

R

rodw

I want to hide colums based on a cells value

so say if a1 = yes i want to hide colums b to f

and if a1 is no then i want to hide g to j

Is thi possibl
 
R

Ron de Bruin

Hi rodw

You can do this with the change event in the worksheet module

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
If LCase(Target.Value) = "yes" Then
Columns("A:IV").Hidden = False
Columns("B:F").Hidden = True
End If
If LCase(Target.Value) = "no" Then
Columns("A:IV").Hidden = False
Columns("G:J").Hidden = True
End If
End If
End Sub
 
Top