View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default insert blank row every 10 rows

Hi Aileen,

I am assuming that you mean that you want 10 rows with data then a blank row
then 10 rows with data etc. If not getting the result you want then see the
comments and edit the code.

Suggest that you back up your workbook before running the code.

Sub InsertRows()

Dim lngInsert As Long
Dim lngIntervals As Long

'Edit 11 in next line with number
'of row to start inserting.
lngInsert = 11

'Edit 10 in next line with number of
'rows with data between inserted rows
lngIntervals = 10

lngIntervals = lngIntervals + 1

ActiveSheet.UsedRange.Cells _
.SpecialCells(xlCellTypeLastCell) _
.EntireRow.Name = "MyLastRow"

Do
ActiveSheet.Rows(lngInsert).Insert
lngInsert = lngInsert + lngIntervals
Loop While lngInsert < Range("MyLastRow").Row

End Sub

--
Regards,

OssieMac


"aileen" wrote:

Is it possible to insert a blank row every 10th row starting from row 11 and
going until the last and variable row of data?