Hiding a column if a cell has an X
What is a "box" and how does the "x" get into that box?
Assume your subject is correct and you mean "cell", you could use some
event code to do the job.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Target.Address = "$A$2" And Target.Value = "x" Then
Sheets("Sheet2").Range("A:A").EntireColumn.Hidden = True
End If
stoppit:
Application.EnableEvents = True
End Sub
Gord
On Fri, 10 Feb 2012 10:44:00 -0800 (PST), tr2yhb
wrote:
I have two sheets in my file.
Here is what I need to do:
If a box in sheet1 has an "x" I want a column (sometimes 2 or 3
columns) on sheet2 to automatically hide.
Thank you for your help.
|