Option Explicit
Option Base 1
Sub Clearer()
Dim X(), myRange As Range, myArea As Range, i As Long, j As Long
Set myRange = Application.InputBox("Pls select your range,", Default:=Selection.Address, Type:=8)
Application.ScreenUpdating = False
For Each myArea In myRange.Areas
If myArea.Cells.Count > 1 Then
X = myArea
For i = 1 To myArea.Rows.Count
For j = 1 To myArea.Columns.Count
X(i, j) = Trim(X(i, j))
Next j
Next i
myArea = X
Else
myArea.Value = Trim(myArea)
End If
Next myArea
Application.ScreenUpdating = True
End Sub
|