ExcelAverage
New Member
- Joined
- Dec 10, 2012
- Messages
- 32
May I post this one query I am having regarding hiding and unhiding rows.
I have the following code to hide and unhide row 5-34. I attached the macro to one button. My problem is I sometimes needed to insert row/s between 5-34. How do I make my code flexible that it will adjust the number of rows if I inserted new ones (varying number of inserted row). Say 5-34 should be 5-39 if I added another 5 rows. Below is the code I found online, too. I am looking for that capability same as dynamic range.
Thanks for the help
-JM
I have the following code to hide and unhide row 5-34. I attached the macro to one button. My problem is I sometimes needed to insert row/s between 5-34. How do I make my code flexible that it will adjust the number of rows if I inserted new ones (varying number of inserted row). Say 5-34 should be 5-39 if I added another 5 rows. Below is the code I found online, too. I am looking for that capability same as dynamic range.
Code:
Sub Hide_Unhide()
With Rows("5:34").Select
.EntireRow.Hidden = Not .EntireRow.Hidden
End With
End Sub
Thanks for the help
-JM