Reputation: 11
I have a dropdown list in cell "B3", containing numbers 1 through 18. 1 corresponds to column C, 2 to column D, 3 to Column E and 18 to column T. I want to achieve the following:
If I select 3 from the dropdown list, column "E" of columns C:T will be visible, if 7 is selected column "I" will be the only column displayed from columns C:T.
I have been unable to find vba codes that work. Does anyone have a solution?
Upvotes: 1
Views: 39
Reputation: 17493
Once you know how to read the value of the dropdown list (call it x
), do following code:
Columns(,x + 2).EntireColumn.Hidden = True
Upvotes: 1