Hide rows

  • Thread starter Thread starter Ashish
  • Start date Start date
A

Ashish

Hello,

I want to have code run when a value in a cell of a
different tab is changed.

Example, if someone changes cell A1 on the "First" tab, I
want it to run code (which I copied below).

The code is wrong also so I need to know how to make it
work. What I want the code to do is to look at the range
j6:j254 on the "Second" tab and hide the entire row if
the value of the cell is "Hide". Please see what I tried
below as it did not work.



Private Sub Button1_Click()

Dim i As Excel.Validation

Cells.Range("j6:j254").Select

For Each i In Selection.Cells
If i = "Hide" Then
Selection.EntireRow.Hidden = True
Selection.EntireRow.Hidden = False
Next i

End Sub

Please help soon. Thanks!
 
Partial answer.
Your code below "unhides" the row immediatley after
it "hides" the row.
 
Back
Top