Hide row code help

J

Jeremy

I am using the following script to hide or unhide rows. How do I code the
offset to only work when a row is being unhid. If we cant do this only
offset when it is being hidden or unhidden?

Thank you

Private Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = False' not necessary
If Not Application.Intersect(Target, Range("B9")) Is Nothing Then
Rows("10:11").Hidden = IIf(UCase(Range("B9")) = "", True, False) 'spelling
ActiveCell.Offset(-6, 0).Select
End If
'Application.EnableEvents = False

End Sub
 
G

Gord Dibben

Hiding/unhiding rows is not a trappable event.

Not clear on what and when you want to occur.


Gord Dibben MS Excel MVP
 

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