MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Two Questions....


Posted by Greg Vincent on March 08, 2001 7:12 AM

Does anyone have any ideas on how to write a macro that
will unhide rows when a cell on another sheet is updated?
I have rows 4-26 hidden. Whe a value is entered into
cell C4 on Sheet 1, i want row 4 on sheet 2 to become
visible. Any suggestions?

Also, I have a macro that runs whenever a value greater
than or equal to 0 is entered into the cell. however,
it also runs whenever I clear the cell. How do I prevent
this?

Thanks in adavance!


Posted by Celia on March 08, 2001 7:44 AM


(1)
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Rows(4 & ":" & 26)) Is Nothing Then
Worksheets("Sheet2").Rows(Target.Row).Hidden = False
End If
End Sub

(2)
If Target <> "" And Target >= 0 Then
MsgBox "Run code"
Else
MsgBox "No code to run"
End If

Celia

Posted by Greg Vincent on March 08, 2001 8:04 AM

Thanks Celia, but I'm still having trouble...

Wher do I put this code? How do I get it to run?

Posted by Celia on March 08, 2001 8:11 AM

Re: Thanks Celia, but I'm still having trouble...

Greg
Put it in the Sheet1 code module (right click on the sheet tab and select View Code to get there).
It will run when any input is made in rows 4 to 26 on Sheet1.
Celia