Thread: Trim Function
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default Trim Function

Thanks Dave but this wouldn't work for me. I was trying that before I posted
my question. Thanks anyway.

"Dave Peterson" wrote:

or maybe...

with cell.Offset(0, 6)
.Value = trim(.Value)
end with

or

with cell.Offset(0, 6)
.Value = application.trim(.Value)
end with

The difference between VBA's Trim and excel's =trim() is how they treat
consecutive internal spaces. VBA's Trim will leave them as-is. Excel's =trim()
will "trim" them to a single character.




Mike wrote:

Nevermind I was having a Brain Freeze. Heres what I have used.
cell.Offset(0, 6).Value = Replace(cell.Offset(0, 6).Value, " ", "")

"Mike" wrote:

Let me be more clear.
The first set of digets will always be 9 char long and the next set of
digits will start at char 16. Id like to loop thru the column and trim the
spaces in the middle

Row1 551569206 024201036
Row2 249721825 019
Row3 249877803 018012
Row4 249877803 018012012236

"Mike" wrote:

how can i trim these values in a loop?

551569206 024201036
249721825 019


--

Dave Peterson