J
Jeremn
Any guidance would be greatly appreciated. I’m trying insert a row if a cell
value is equal to a number, and then copy that value to a cell in the new row
.. For example: if A1=â€x†then insert a row between row 1 and 2 and copy the
value of A1 into B2 of the inserted row. Thank you very much whoever can
help!
A B C D
1 x datae .25 0
<Insert new row here>
2 stuff moredata .20 2.1
3 other pcs 2.1 0
I’ve got this code thus far:
Sub testme()
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet
Set wks = Worksheets("sheet1")
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = LastRow To FirstRow Step -1
If LCase(.Cells(iRow, "A").Value) = LCase("x") Then
.Rows(iRow + 1).EntireRow.Insert
End If
Next iRow
End With
value is equal to a number, and then copy that value to a cell in the new row
.. For example: if A1=â€x†then insert a row between row 1 and 2 and copy the
value of A1 into B2 of the inserted row. Thank you very much whoever can
help!
A B C D
1 x datae .25 0
<Insert new row here>
2 stuff moredata .20 2.1
3 other pcs 2.1 0
I’ve got this code thus far:
Sub testme()
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet
Set wks = Worksheets("sheet1")
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = LastRow To FirstRow Step -1
If LCase(.Cells(iRow, "A").Value) = LCase("x") Then
.Rows(iRow + 1).EntireRow.Insert
End If
Next iRow
End With