Hi All,
So, the user selects a column within the data that he/she wants to remove a preceeding comma from (sometimes space comma). So I want to create a column to the right of the data with a formula in it to achieve this. This will actually be a series of commands but I figure if I can figure this out, I can get the rest. The formula would be (assuming that Column U is selected)

=TRIM(MID(TRIM(U2),IF(LEFT(TRIM(U2),1)=",",2,1),254))

Here's my code
Sub Macro1()
'
' Macro1 Macro
'
    CommaStr = ","
    LastCol = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column + 1
    LastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
    Set DataRange = Range(Cells(2, Selection.Column), Cells(LastRow, Selection.Column))
    MyOffset = LastCol - DataRange.Column
 
'Remove Commma at beginning
    DataRange.Offset(0, MyOffset).Formula = "=TRIM(MID(TRIM(" & Address(DataRange.Row, DataRange.Offset(0, MyOffset).Column) & "),IF(LEFT(TRIM(" & Address(DataRange.Row, DataRange.Offset(0, MyOffset).Column) & ",1)=" & CommaStr & "),2,1),254))"
It's not working. I get an error on that last line naturally.
Thanks