View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
okrob okrob is offline
external usenet poster
 
Posts: 142
Default Adding blank rows every 3rd row

To partially plagarize you Bob, she's wanting this to show every 3rd
row starting at the top as a blank, with a header row...

liz25mc,
Change this: For i = iLastRow - (iLastRow Mod 3) To 2 Step -3
To this: For i = 5 To (iLastRow - (iLastRow Mod 3)) Step 3

ALSO, in Bob's code, you don't need these lines, unless you're using
them somewhere else...

Const FIRST_ROW As Long = 0 '<=== set to 2,1, or 0
Dim cell As Range
Dim sh As Worksheet

The Const TEST_COLUMN As String = "A" sets the column your looking at.
So, if your data is in column B, change that to B, etc...

Rob


liz25mc wrote:
Hi Bob,

Thanks for the code. I'm not sure I understand what:
Const TEST_COLUMN as String = "A" does.

The first row iin the spreadsheet contains field names (sorry, I should have
mentioned that in my previous post).
When I run the code I get two rows and then a blank on the first three rows,
and then a blank after every third row in the rest of the spreadsheet.
Wondering what I am doing wrong, and hope you can set me straight on what
changes I need to make to the code.

Thanks again.

"Bob Phillips" wrote:

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Const FIRST_ROW As Long = 0 '<=== set to 2,1, or 0
Dim i As Long
Dim iLastRow As Long
Dim cell As Range
Dim sh As Worksheet

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow - (iLastRow Mod 3) To 2 Step -3
Rows(i).Insert
Next i

End With

End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"liz25mc" wrote in message
...
Can someone provide coding to add a blank row every 3rd row in Excel 2003.

Thanks in advance!