Thread: Macro Help
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Martin Fishlock Martin Fishlock is offline
external usenet poster
 
Posts: 694
Default Macro Help

Mike

Try this: I assume it is run on the active sheet and the data starts on row
2 with headings on row 1.

Option Explicit

Sub insertrows()

Const cdInc As Double = 10000
Const clRowStart As Long = 2
Dim lrow As Long
Dim dVal As Double

lrow = clRowStart
dVal = cdInc * 2

With ActiveSheet
Do While lrow < .Cells.Rows.Count
If .Cells(lrow, 1) = "" Then
Exit Sub
End If
If .Cells(lrow, 1).Value dVal Then
.Rows(lrow - 1).Insert
dVal = dVal + cdInc
lrow = lrow + 2
Else
lrow = lrow + 1
End If
Loop
End With
End Sub

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Mike" wrote:

Hello,
Could someone please help me with a macro that will insert a row between
Groups
of Numbers. I would like to be able to insert a row between =10000 and
<=19999,
=20000 and <=29999, =30000 and <=39999, =40000 and <=49999, =50000 and<=59999 and so on upto 100000. I export this from Quickbooks and have to insert rows manually


Thanks in advance for any help

Vender Parts UPC Item Description QTY
11003
15002
17000
18000
19000
19999
20000
21000
25000
26000
26010