This is the concatenation macro I have for 2 columns. I want to make this more general in that I would like the program to insert a new column to the right and concatenate the 2 columns based on the current cell the cursor is on and the one adjacent to the left (-1). The loop works fine, the modification I need is for the following three (3) lines.
Thanks,![]()
Columns("I:I").Select Selection.Insert Shift:=xlToRight Range("H2").Select Sub ConcatColumns() Columns("I:I").Select Selection.Insert Shift:=xlToRight Range("H2").Select Do While ActiveCell <> "" 'Loops until the active cell is blank. 'The "&" must have a space on both sides or it will be 'treated as a variable type of long integer. ActiveCell.Offset(0, 1).FormulaR1C1 = _ ActiveCell.Offset(0, 0) & " - " & ActiveCell.Offset(0, -1) ActiveCell.Offset(1, 0).Select Loop End Sub
Jim15
Bookmarks