Macro

K

kartk

Hi,

I have an requirement in excel to Expand & collapse rows for a certai
range.
Below is the code written for the same,
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, [H5]) Is Nothing Then
[6:10].Rows.Hidden = True

'End If

If Not Intersect(Target, [E:E]) Is Nothing Then
[6:10].Rows.Hidden = False
End If

End Sub

However if an user insert a new row i want to include the additional ro
dynamically to the existing range. Please hel
 
K

kartk

'Jim Cone[_2_ said:
;1207821']Name the range and use the range in your code.

Me.Range("MyRows").Rows.Hidden = True

--
Jim Cone
Portland, Oregon USA
http://www.contextures.com/excel-sort-addin.html
editorial review of special sort excel add-in (30 ways to sort)





"kartk" <[email protected]>
wrote in message
Hi,

I have an requirement in excel to Expand & collapse rows for certain
range.
Below is the code written for the same,
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, [H5]) Is Nothing Then
[6:10].Rows.Hidden = True

'End If

If Not Intersect(Target, [E:E]) Is Nothing Then
[6:10].Rows.Hidden = False
End If
End Sub

However if an user insert a new row i want to include the additiona row
dynamically to the existing range. Please help

Hi Jim,

Thanks a lot...
 

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