Sub test()
Application.ScreenUpdating = False
For Each Cell In ActiveSheet.UsedRange
If Cell.HasFormula = False Then
Cell.Value = Strings.Trim(Cell.Value)
End If
Next Cell
Application.ScreenUpdating = True
End Sub
I wish to do a countif trimming both the range and the criteria and don't know how to trim the range. =countif(A$2:A$10,TRIM(A2) but with a Trim of A2:A10. In other words a countif ignoring leading and trailing spaces.
=SUMPRODUCT((TRIM(A$2:A$10)=TRIM(E2))+0)