dartanion_jm
asked on
Excel VBA Macro to hide/unhide every 3rd, 4th & 5th row
Greetings; I need an Excel VBA Macro to hide/unhide every 3rd, 4th & 5th row on a particular workbook. I found a macro that hides every 3rd and 4th row but I haven't been able to figure out how to modify it to include the 5th row.
Thanks in advance for your consideration.
Thanks in advance for your consideration.
Hides every 3rd and 4th row:
Sub hiderows()
For i = Cells(Rows.Count, "a").End(xlUp).Row - 1 To 2 Step -3
Rows(i).Resize(2).Hidden = True
Next i
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Greetings Rorya; Sorry for the confusing (am) explanation.
What I'm looking for (after rows 1 and 2 are left unhidden) is for rows 3,4, & 5 hidden; then leave row 6 unhidden; then hide rows 7, 8 & 9 and continue on for the rest spreadsheet.
Unhidden
Unhidden
Hidden
Hidden
Hidden
Unhidden
Hidden
Hidden
Hidden
Unhidden
Thanks again.
What I'm looking for (after rows 1 and 2 are left unhidden) is for rows 3,4, & 5 hidden; then leave row 6 unhidden; then hide rows 7, 8 & 9 and continue on for the rest spreadsheet.
Unhidden
Unhidden
Hidden
Hidden
Hidden
Unhidden
Hidden
Hidden
Hidden
Unhidden
Thanks again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Matrix (1999) - Morpheus: "You are the ONE, Rorya!"
It works perfectly. Thank You for the prompt responses and your patience.
It works perfectly. Thank You for the prompt responses and your patience.
ASKER
Unfortunately the script provided unhid the 1st 5 rows; then hid the next 2 rows; unhide the next row then hid the next 3 rows. Still can't figure this script out.
The original script provided is close...Unhide rows 1 and 2; hide rows 3 and 4.
Just need it to unhide rows 1 and 2; hide rows 3, 4 and 5; unhide row 6; hide rows 7, 8 & 9; unhide row 10; hide rows 11, 12 & 13...and continue on.
Any assistance you can provide is greatly appreciated. Thanks for your efforts.