Insert new row on change, then formula

hg1027

Board Regular
Joined
Apr 28, 2008
Messages
56
So I got the code from vogII to add a new row after a change in a column (I in this case):

Dim LR As Long, i As Long
LR = Range("I" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
If Range("I" & i).Value <> Range("I" & i - 1).Value Then
Rows(i).EntireRow.Insert shift:=xlShiftDown
End If
Next i

And now I want to add a formula to the new blank cells in column B. The formula will be =IF(H3="FAB","FAB DWG "&G3,"INSTALL DWG "&G3).

Also, some of the text that comes in to my description field has more info than I need, which I text-to-columns to the first 4 empty columns (starts with K right now). I'd like to combine the last 3 (L,M,N) in B and then copy and paste values in B (this will take place before adding the rows and formula from above). I've almost got the combine and delete parts, but the combine only works for the first cell in my range. Also, I haven't put in the copy-paste values section because I'm about to have to leave.

Range("B2:B").Select
ActiveCell.FormulaR1C1 = "=RC[9]&RC[10]&RC[11]"

'copy/paste values of column B would go in here

Columns("K:N").Select
Selection.Delete Shift:=xlToLeft

I'm sure I've left out some vital part of all this but I'll definitely check back soon. Thanks for any effort.

Henry
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

hg1027

Board Regular
Joined
Apr 28, 2008
Messages
56
Well I've realized I can sort by name after inserting the rows and get all the blanks at the top, which might make a fill a little easier.
 
Upvote 0

Forum statistics

Threads
1,190,831
Messages
5,983,129
Members
439,825
Latest member
glen3265

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
Top