Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim function in VBA
Hi, I would like to know how to write a macro that selects all rows/column on a worksheet and perform the trim function (both right and left within each cell. thanks a lot! -- molavi11 ----------------------------------------------------------------------- molavi111's Profile: http://www.excelforum.com/member.php...fo&userid=1461 View this thread: http://www.excelforum.com/showthread.php?threadid=26244 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim function in VBA
Actually, I think you need Application.Selection.Cells
my bad "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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trim function | Excel Discussion (Misc queries) | |||
trim function | Excel Worksheet Functions | |||
Need help with TRIM function | Excel Worksheet Functions | |||
Trim Function | Excel Worksheet Functions | |||
How to use TRIM function | Excel Worksheet Functions |