I'm trying to use a macro to insert a column into column P, then paste the following formula '= Mid(O2, Find("-", O2) + 1, Find("^^", Substitute(O2, "-", "^^", 2)) - Find("-", O2) - 1)' into cell P2. This formula extracts the data between 2 hyphens. I then would like this formula to be copied down, an X number of rows, which can be dependant on the row count in Column B. Im certain Im not putting this formula into the macro correctly, but Im new to this and any help would be greatly appreciated.
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("P1").Select
ActiveCell.FormulaR1C1 = "Store Number"
Selection.Font.Bold = True
Range("P2").Select
ActiveCell.FormulaR1C1 = Mid(O2, Find("-", O2) + 1, Find("^^", Substitute(O2, "-", "^^", 2)) - Find("-", O2) - 1)
Range("P2").Select
Selection.Copy
Range("P2:P" & Range("B" & Rows.Count).End(3)(1).Row).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
Thanks in advance.
Thanks,
Ray
Bookmarks