just for kicks, I tried entering this from scratch, not even knowing if it would work. Though I later discovered that formal coding requires a little more, nonetheless, the code works.
My question is: I've read here a few times that if at all possible, avoid loops. Is there a way to achieve the end-result (trimming text values) without looping? Possibly using a WITH (object / feature) type of syntax?
My question is: I've read here a few times that if at all possible, avoid loops. Is there a way to achieve the end-result (trimming text values) without looping? Possibly using a WITH (object / feature) type of syntax?
Code:
Sub trimall()
For Each cell In Selection
cell.Value = Trim(cell.Value)
Next cell
End Sub