I want to write a macro that will hide columns base on a drop down list. My drop down is located in Cell A3 and contains 6 names. These names are located in each column (C through the end of the worksheet) in row2 (C2 to ???2). The names appear in random order. When I select a particular name from the drop down I want the macro to hide the other 5 names not selected.
So far I've got
But I can't figure out how to write the case to hide the columns I want hidden![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Not Application.Intersect(Range("A3"), Target) Is Nothing Then Columns("c:k").EntireColumn.Hidden = False Select Case Target.Value Case "Name 1": End Select End If End Sub
Moderator's Edit: Use code tags when posting code. To do so in future, select your code and click on the # icon above.
Bookmarks