View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Trim function in VBA

Try this:

Public Sub TrimItAll()

For Each objC In Application.Selection

objC.Value = Trim(objC.Value)

Next

End Sub



"molavi111" wrote:


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