ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Hide row code help (https://www.excelbanter.com/excel-discussion-misc-queries/252446-hide-row-code-help.html)

Jeremy

Hide row code help
 
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


Gord Dibben

Hide row code help
 
Hiding/unhiding rows is not a trappable event.

Not clear on what and when you want to occur.


Gord Dibben MS Excel MVP

On Tue, 5 Jan 2010 07:57:01 -0800, Jeremy
wrote:

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




All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com