Thanks John,
Reading over the link you attached, I have two questions:-
I though my original code (which has been doctored from this site!) was working from the end, up
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
The other thing is that Im not sure how to bend the formula on the link
Sub InsertRows()
Dim iRow As Long
Dim rCount As Integer 'running count of inserted rows
Dim iCount As Integer 'number of rows to insert
Dim i As Integer
Dim Bval As Variant 'Col B cell value to be written to new lines
rCount = 0
For iRow = [a65536].End(xlUp).Row To 2 Step -1
If Cells(iRow, 5) = 1 Then
iCount = Cells(iRow, 1) - Cells(iRow - 1, 1) - 1
Bval = Cells(iRow, 2)
For i = 1 To iCount
rCount = rCount + 1
Rows(iRow).Insert
Cells(iRow, 2) = Bval
Next i
End If
Next iRow
Beep
MsgBox rCount & " rows inserted", vbInformation, "Results"
End Sub
around what Im after. I dont understand what the component part are and how my requirements (based on my code) interact with these. I have tried
Sub insertrows()
Dim iRow As Long
Dim rCount As Integer 'running count of inserted rows
Dim iCount As Integer 'number of rows to insert
Dim i As Integer
Dim Bval As Variant 'Col B cell value to be written to new lines
rCount = 0
For iRow = [a65536].End(xlUp).Row To 2 Step -1
If Cells(iRow, "W") = "RAN" Then
iCount = Cells(iRow, 1) - Cells(iRow - 1, 1) - 1
Bval = Cells(iRow, 2)
For i = 1 To iCount
rCount = rCount + 1
Rows(iRow).Insert
Cells(iRow, 2) = Bval
Next i
End If
Next iRow
End Sub
But it fails at
iCount = Cells(iRow, 1) - Cells(iRow - 1, 1) - 1
Also how do I get the "7G" bit in?
Thanks again
Alex
Bookmarks