• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to hide / unhide column by using formula

atulrajratna

New Member
How can we hide or unhide column by using formula when we are entering value in any cell.


e.g in A1 if i will enter 1 then Column F will hide and if i will enter any other number or if i will delete that 1 from A1, then Column F will unhide.


please help me in this.

Thank you!
 
Can't do it just using formulas. But you can use this event macro (right click on sheet tab, paste in)

[pre]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Range("A1") = 1 Then
Range("F:F").EntireColumn.Hidden = True
Else
Range("F:F").EntireColumn.Hidden = False
End If
Application.EnableEvents = True
End Sub
[/pre]
 
Back
Top