Hide rows

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!
 
T

Tim Kredlo

Partial answer.
Your code below "unhides" the row immediatley after
it "hides" the row.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top