Hi, I have tried allsorts with this and now with very little hair not already pulled out, it's time to ask for help.
I have a simple worksheet where:
A1=8
B1=9
C1=10
D1=11
etc, etc to
AV=55
In cell AX1 I will enter a value between 8 and 55 and I want to hide all the columns apart from the one were the value in row 1 matches.
I could achieve it by completing the code below, but I'm certain there must be a shorter and more elegant way of matching the value and then hiding all others in the range:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Columns("A:AV").EntireColumn.Hidden = False
Select Case Range("AX1").Value
Case 8:
Columns("B:AV").EntireColumn.Hidden = True
Case 9:
Columns("A:A").EntireColumn.Hidden = True
Columns("C:AV").EntireColumn.Hidden = True
Case 10:
Columns("A:B").EntireColumn.Hidden = True
Columns("D:AV").EntireColumn.Hidden = True
Case 11:
Columns("A:C").EntireColumn.Hidden = True
Columns("E:AV").EntireColumn.Hidden = True
' etc, etc
End Select
End Sub
Any help would be really appreciated, Mike
Bookmarks