Eloise T
Active Member
I want to insert the TRIM function into the line of code below so the date will not have any leading or trainling spaces (ASCII 32).
The line:
If .NumberFormat <> "mm/dd/yyyy" Then .NumberFormat = TRIM("mm/dd/yyyy")
is found in the 8th row of code below. There's no error message given but it doesn't remove any spaces.
Thanks for your assistance.
The line:
If .NumberFormat <> "mm/dd/yyyy" Then .NumberFormat = TRIM("mm/dd/yyyy")
is found in the 8th row of code below. There's no error message given but it doesn't remove any spaces.
Code:
Dim lRow As Long, iColumn As Integer, lRowest As Long
lRow = 3
iColumn = 7
With Ws
lRowest = .Cells(.Rows.Count, iColumn).End(xlUp).Row
Do While lRow <= lRowest
With .Cells(lRow, iColumn)
If .NumberFormat <> "mm/dd/yyyy" Then .NumberFormat = TRIM("mm/dd/yyyy")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
lRow = lRow + 1
End With
Loop
End With
Thanks for your assistance.
Last edited: