Forum Discussion
SamFares40
Mar 14, 2020Copper Contributor
Hiding Columns Based on a Cell Value
Hello, I added the following VBA into the module and set B4 =0, but it wont hide column H. I am not sure why. the information is in sheet 1 Private Sub Worksheet_SelectionChange(ByVal Target ...
- Mar 15, 2020
SamFares40 your problem is WHERE you put that VBA code. You put it in Module1, but the Worksheet_SelectionChange needs to be in the sheet it is meant to act on, in this case Sheet1 (expand Microsoft Excel Objects to find it). I move it to that code sheet and it worked fine.
mtarler
Mar 15, 2020Silver Contributor
SamFares40 your problem is WHERE you put that VBA code. You put it in Module1, but the Worksheet_SelectionChange needs to be in the sheet it is meant to act on, in this case Sheet1 (expand Microsoft Excel Objects to find it). I move it to that code sheet and it worked fine.
- SamFares40Mar 15, 2020Copper Contributor
Thank you so much mtarler