TrimTextRange

M

MrPetreli

Hi Guys

I have a Trim text code, but how do I change it to trim only the rang
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 Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top