Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In column D of my worksheet some of the cell contents have a varying number
of spaces. How can I removed any leading spaces from those cells with VBA? There are spaces within the cells (not leading) that I want to keep. Example below. Here is what I have now: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Here is what I'd like to end up with: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Thanks in advance! Scott |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Scott Wagner Wrote: In column D of my worksheet some of the cell contents have a varyin number of spaces. How can I removed any leading spaces from those cells wit VBA? There are spaces within the cells (not leading) that I want to keep. Example below. Here is what I have now: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Here is what I'd like to end up with: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Thanks in advance! Scott I must either be either rather ****ed or need to get my eye sigh tested but there does not seem to a difference between what you hav now and what you want -- funkymonkU ----------------------------------------------------------------------- funkymonkUK's Profile: http://www.excelforum.com/member.php...fo&userid=1813 View this thread: http://www.excelforum.com/showthread.php?threadid=51616 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() try using the following; Dim i% do Cells(i, 4).Value = Trim(Cells(i, 4).Value) loop until Cells(i, 4).Value = "" -- gti_jobert ------------------------------------------------------------------------ gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634 View this thread: http://www.excelforum.com/showthread...hreadid=516163 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try
=SUBSTITUTE(A14,CHAR(160),"") -- Don Guillett SalesAid Software "Scott Wagner" wrote in message ... In column D of my worksheet some of the cell contents have a varying number of spaces. How can I removed any leading spaces from those cells with VBA? There are spaces within the cells (not leading) that I want to keep. Example below. Here is what I have now: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Here is what I'd like to end up with: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Thanks in advance! Scott |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim myCell as range
for each mycell in selection.cells mycell.formula = ltrim(mycell.formula) next mycell Scott Wagner wrote: In column D of my worksheet some of the cell contents have a varying number of spaces. How can I removed any leading spaces from those cells with VBA? There are spaces within the cells (not leading) that I want to keep. Example below. Here is what I have now: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Here is what I'd like to end up with: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Thanks in advance! Scott -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks to all for responding!
"Dave Peterson" wrote: dim myCell as range for each mycell in selection.cells mycell.formula = ltrim(mycell.formula) next mycell Scott Wagner wrote: In column D of my worksheet some of the cell contents have a varying number of spaces. How can I removed any leading spaces from those cells with VBA? There are spaces within the cells (not leading) that I want to keep. Example below. Here is what I have now: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Here is what I'd like to end up with: ColD This is the text Blah Blah Blah Blah Blah Blah Blah This is the text Thanks in advance! Scott -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I remove leading spaces the column is left justified | Excel Discussion (Misc queries) | |||
how do you remove leading spaces etc in cells? | New Users to Excel | |||
remove leading spaces | Excel Worksheet Functions | |||
how do I remove leading spaces and leave the remianing spaces w | Excel Worksheet Functions | |||
Remove Leading Spaces | Excel Discussion (Misc queries) |