Thread: TrimTextRange
View Single Post
  #1   Report Post  
MrPetreli MrPetreli is offline
Junior Member
 
Posts: 7
Default TrimTextRange

Hi Guys

I have a Trim text code, but how do I change it to trim only the range selected?

Sub TrimTextRange()

Application.ScreenUpdating = False

Dim cell As Range, areaToTrim As Range
Set areaToTrim = Sheet1.Range("A1:H1000")
For Each cell In areaToTrim
cell.Value = Trim(cell.Value)
Next cell

End Sub