I have a macro that trims leading spaces from every cell in a worksheet. In large spreadsheets, it is slow because most cells don't have leading spaces and trimming them is wasted time. How would I modify the macro so that it firsts tests to see if a leading space is present in a cell, and only trimming those where one is? In concept it's simple, eg. read the first character in a cell, iff it is a space, then replace the cell value with the trimmed cell value. Just don't know how to write it in code. Here is my existing macro:
Sub RemoveLeadingSpace()
For Each cel In ActiveSheet.UsedRange
cel.Value = Trim(cel.Value)
Next cel
End Sub