Hidding colomns according to a condition

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

Hi,
A code to hide colomns depending on a certain value:
Hide colomns AI, AJ, AK if cell AJ9="" (empty)
Hide colomns AL, AM, AN if cell AM=""
Hide colomns AO, AP, AQ if cell AP9=""
Hide colomns AR, AS, AT if cell AS9=""

Is it possible?
 
Columns("AI:AK").Hidden = Range("AJ9").Value = ""
Columns("AL:AN").Hidden = Range("AM9").Value = ""
Columns("AO:AQ").Hidden = Range("AP9").Value = ""
Columns("AR:AT").Hidden = Range("AS9").Value = ""


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Is this a calculate vent??? How should I place it so that it works
automatically???
Note: When I run the code manually it works well.
Thanks
 
If AJ9, AM9, AP9 and AS9 contain formulas, then put the code in the
worksheet_calculate event.

If those cells are changed because of the user's typing, then you could use the
worksheet_Change event.
 
Back
Top