Insert a new row of data whenever a cell in a colmn equals "R"

bat18

Board Regular
Joined
Mar 29, 2010
Messages
89
Hi

I am looking to insert a row every time any cell in column A = R

This will happen around 50 times.

The inserted row will need to have an R in column A and the number 349273 in column B.

Any help on this would be greatly appreciated.

Cheers
 
Column A consists of R's or blanks. Whenever an R appears i need a row inserting above it with another R put in the new row in column A and the number 349273 in the corresponding cell in column B

Thanks
 
Upvote 0
Something along the lines of

Dim i As Long
Dim LASTROW As Long

LASTROW = Cells(Rows.Count, 1).End(xlUp).Row

For i = LASTROW To 1 Step -1
If InStr(Range("A" & i).Value, "R") Then
Range("A" & i).EntireRow.Insert Shift:=xlDown
Range("A" & i).Value = "R"
Range("A" & i).Offset(0, 1).Value = 349273
End If
Next i
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top