Hi all,
I have the following code, which is supposed to combine the values from column I and column AD:
Sub Pro1()
Sheets("GR4").Select
Columns("AF:AF").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Dim lastRow As Long
lastRow = Cells(rows.Count, "AD").End(xlUp).Row
Columns("AF:AF").Select
Selection.NumberFormat = "General"
Range("AF2:AF" & lastRow).FormulaR1C1 = "=right(AD2,10)&left(I2,14)"
Range("AF2").CurrentRegion.Select
End Sub
When running the code it works, but I get a #NAME error in the worksheet, and the formula appears in column AF as =right('AD2',10)&left('I2',14) with the ' ' around the cell references
Any ideas why?
Bookmarks