Hiding a row when a cell has a value

  • Thread starter Thread starter Souljacked
  • Start date Start date
S

Souljacked

Hi all,

I would like to hide a row when an option is ticked/unticked. For example;

if(a1="x", row20=shown, row20=hidden)

Thanks for any help,
Souljacked
 
Try the Event-Macro:
-----------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If UCase([A1]) = "X" Then
Rows(20).EntireRow.Hidden = True
Else
Rows(20).EntireRow.Hidden = False
End If
End Sub
 
Or maybe this:
-----------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Rows(20).EntireRow.Hidden = False
If UCase([A1]) = "X" Then Rows(20).EntireRow.Hidden = True
End Sub
-------------
Micky


מיכ×ל (מיקי) ×בידן said:
Try the Event-Macro:
-----------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If UCase([A1]) = "X" Then
Rows(20).EntireRow.Hidden = True
Else
Rows(20).EntireRow.Hidden = False
End If
End Sub
------------------
Micky


Souljacked said:
Hi all,

I would like to hide a row when an option is ticked/unticked. For example;

if(a1="x", row20=shown, row20=hidden)

Thanks for any help,
Souljacked
 
It may??? be best to restrict to the cell

Private Sub Worksheet_Change(ByVal Target As Range)
if target.address <>range("a1").address then exit sub

Rows(20).Hidden = False
If UCase(target) = "X" Then Rows(20).Hidden = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
מיכ×ל (מיקי) ×בידן said:
Or maybe this:
-----------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Rows(20).EntireRow.Hidden = False
If UCase([A1]) = "X" Then Rows(20).EntireRow.Hidden = True
End Sub
-------------
Micky


מיכ×ל (מיקי) ×בידן said:
Try the Event-Macro:
-----------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If UCase([A1]) = "X" Then
Rows(20).EntireRow.Hidden = True
Else
Rows(20).EntireRow.Hidden = False
End If
End Sub
------------------
Micky


Souljacked said:
Hi all,

I would like to hide a row when an option is ticked/unticked. For
example;

if(a1="x", row20=shown, row20=hidden)

Thanks for any help,
Souljacked
 
Back
Top