View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Trim Difficulties

one more change required:

Dim mystring, trimstring
Dim i As Range
Dim MyRange As Range
Set MyRange = Range("F56:F132")

For Each i In MyRange

mystring = i.value
trimstring = Trim(mystring)
i = trimstring

Next i

End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Dim mystring, trimstring
Dim i As Range
Dim MyRange As Range
Set MyRange = Range("F56:F132")

For Each i In MyRange

mystring = i.value
trimstring = Trim(mystring)
MyRange = trimstring

Next i

End Sub

--
Regards,
Tom Ogilvy

"WillRn" wrote in message
...
I am trying to write a code that will remove a blank character in the

from
the left side of cells in a particular range. After several permutations

and
trials, I only get the first cell's value pasted into all the cells in

the
rage.

Here is the lastest code I have tried:

Sub SpaceRemover()

Dim mystring, trimstring
Dim i As Range
Dim MyRange As Range
Set MyRange = Range("F56:F132")

For Each i In MyRange

mystring = ActiveCell
trimstring = Trim(mystring)
MyRange = trimstring

Next i

End Sub


I have also tried LTrim with the same results, . . .

Any help would be greatly appreciated,

Will