Dear Expert,
I would like to insert column between A column and B Column.
Next add formula Trim in the new column in order to remove spacebar at material code.
Next copy formula go down until last row data.
at this time I can use macro only insert and need to how can add formula.
Attached please find the Excel file.
Remove spacebar .xlsx
PS. macro use insert column.
Sub Insrt_Mat()
Dim Found As Range
Dim LR As Long
Set Found = Rows(1).Find(what:="Material", LookIn:=xlValues, lookat:=xlWhole)
If Found Is Nothing Then Exit Sub
LR = Cells(Rows.Count, Found.Column).End(xlUp).Row
Found.Offset(, 1).EntireColumn.Insert
Cells(1, Found.Column + 1).Value = ""
'Range(Cells(2, Found.Column + 1), Cells(LR, Found.Column + 1)).FormulaR1C1 = "=Trim(A2)"
End Sub
Bookmarks