Hello,
I have a sheet with a series of 4 digit numbers in column A. These numbers start out above 1000, and then move through the 2000's, 3000's, etc. They do not exceed 9999. I'm looking to insert a row when the first digit increases, so I can visually group these numbers together by thousands, two thousands, etc.
The code I have right now is definitely not working for me:
After I get this working, my next step is to insert text into the newly created row. I haven't even bothered to attempt that yet. Any help you can provide would be greatly appreciated! Thanks.
I have a sheet with a series of 4 digit numbers in column A. These numbers start out above 1000, and then move through the 2000's, 3000's, etc. They do not exceed 9999. I'm looking to insert a row when the first digit increases, so I can visually group these numbers together by thousands, two thousands, etc.
The code I have right now is definitely not working for me:
Code:
Sub AddLine()
Dim d As Integer
Dim a As Integer
d = Range("A:A").End(xlDown).Row
a = 1
Dim c As Range
For i = d To 1 Step -1
If Left(Cells(i, 1), 1) = a Then
Rows(Cells(i + 1, 1).Row).Insert shift:=xlDown
a = a + 1
End If
Next
End Sub
After I get this working, my next step is to insert text into the newly created row. I haven't even bothered to attempt that yet. Any help you can provide would be greatly appreciated! Thanks.
Last edited: