Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Markus,
assuming your "numbers" column is in the range A1:A... then this nasty little routine should sort it out for you. If you have any problems getting it to run, it may be because the Usedrange is different from what you think. If that happens, replace "LastRow" in the "For.." statement with the number of the last line in your list: Sub AddRows() LastRow = ActiveSheet.UsedRange.Rows.Count For x = LastRow To 2 Step -1 If Cells(x, 1).Value < (Cells(x - 1, 1).Value + 1) Then Rows(x).Insert Cells(x, 1).Value = Cells(x + 1, 1).Value - 1 x = x + 1 End If Next x End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Automatically Insert New Rows | Excel Discussion (Misc queries) | |||
Insert a rows automatically | Excel Worksheet Functions | |||
How do I automatically insert rows | Excel Discussion (Misc queries) | |||
Automatically Insert New Rows | Excel Discussion (Misc queries) | |||
Automatically insert/delete rows to be x apart | Excel Discussion (Misc queries) |