phillipcook
Board Regular
- Joined
- Jun 25, 2015
- Messages
- 87
Hi Everyone
I am trying to make excel hide or un-hide columns based on specific values. I have tried a few different macros, but just cant seem to get it right. What I am trying to achieve is as below:
Columns in range are J:P.
1) if cell E4 = "Site 2" then column J will show, if cell E4 is blank or has any other value, then J will hide
2) if cell A10 = "SW - Monthly" then column K will show, if cell is blank or has other value then K will hide.
3) If Cell A10 = "SW - Investigation" then column L will show, if cell is blank or has other value than L will hide
4) If Cell A10 = "PW - Investigation" then column M will show, if cell is blank or has other value than M will hide
5) If Cell A10 = "GW - Investigation" then column N:O will show, if cell is blank or has other value than N:O will hide
6) If Cell A10 = "DW - Daily" or "DW - Weekly" or "DW - Investigation" then column P will show, if cell is blank or has other value than P will hide
7) I need to repeat parts 2 - 6 from A10 to A19. Not sure if in the code it can look for the specific value between A10:A19 or if we have to do the code for each cell.
I've been trying to work this one out for days, but my VBA/ code/ Macro side of excel isn't my strong point.
Thanks heaps in advance!!!
I am trying to make excel hide or un-hide columns based on specific values. I have tried a few different macros, but just cant seem to get it right. What I am trying to achieve is as below:
Columns in range are J:P.
1) if cell E4 = "Site 2" then column J will show, if cell E4 is blank or has any other value, then J will hide
2) if cell A10 = "SW - Monthly" then column K will show, if cell is blank or has other value then K will hide.
3) If Cell A10 = "SW - Investigation" then column L will show, if cell is blank or has other value than L will hide
4) If Cell A10 = "PW - Investigation" then column M will show, if cell is blank or has other value than M will hide
5) If Cell A10 = "GW - Investigation" then column N:O will show, if cell is blank or has other value than N:O will hide
6) If Cell A10 = "DW - Daily" or "DW - Weekly" or "DW - Investigation" then column P will show, if cell is blank or has other value than P will hide
7) I need to repeat parts 2 - 6 from A10 to A19. Not sure if in the code it can look for the specific value between A10:A19 or if we have to do the code for each cell.
I've been trying to work this one out for days, but my VBA/ code/ Macro side of excel isn't my strong point.
Thanks heaps in advance!!!