custom views / macros

K

Khardy3352

I created a custom view from a master document that included every third row
hidden (I manually hid every third row for 1000 rows -whew!). I added a macro
that showed a particular heading row for that view, and assigned a shortcut.
I saved the worksheet as a template. The worksheet was then re-saved with a
new name, cells filled in. The custom view worked a few times, then stopped
hiding every third row in the view.
1. I don't know why the view stopped hiding the rows and
2. can you help me write a macro that will automatically hide every third
row??
 
C

CurlyDave

This will Hide every third row starting with row 3 change the "For
i=3" to whatever row you want it to start at

Sub HideThirdRow()
fnl = Cells(65536, 1).End(xlUp).Row
For i = 3 To fnl Step 3
Cells(i, i).EntireRow.Hidden = True
Next i

End Sub

This will un-Hide the rows

Sub UnHideRows()
fnl = Cells(65536, 1).End(xlUp).Row
For i = 1 To fnl Step 2
Cells.EntireRow.Hidden = False
Next i

End Sub
 

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