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

Sub doATrim()
for each cell in Activesheet.UsedRange.specialCells(xlconstants,
xlTextValues)
cell.Value = trim(cell.Value)
Next
End Sub

--
Regards,
Tom Ogilvy


"molavi111" wrote in message
...

Hi,

I would like to know how to write a macro that selects all rows/columns
on a worksheet and perform the trim function (both right and left)
within each cell.

thanks a lot!!


--
molavi111
------------------------------------------------------------------------
molavi111's Profile:

http://www.excelforum.com/member.php...o&userid=14618
View this thread: http://www.excelforum.com/showthread...hreadid=262446