bconner
05-11-2010, 06:20 AM
Hello All,
I am trying to add a formula in column B that will Trim() data in Column A.
Below is the code I am using but I keep getting an object defined error
Sub Format_DBMS_Dictionary_Description()
Dim RngStart As Range
Dim RngEnd As Range
Set RngEnd = Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
Range("A1").Activate
For Each RngStart In RngEnd
RngStart.Offset(0, 1).Formula = "=Trim(A1)"
Next RngStart
End Sub
I am trying to add a formula in column B that will Trim() data in Column A.
Below is the code I am using but I keep getting an object defined error
Sub Format_DBMS_Dictionary_Description()
Dim RngStart As Range
Dim RngEnd As Range
Set RngEnd = Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
Range("A1").Activate
For Each RngStart In RngEnd
RngStart.Offset(0, 1).Formula = "=Trim(A1)"
Next RngStart
End Sub