Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Spaces
I also need another short macro that could go through an
entire sheet deleting a space where it found it at the beginning of a cell, but not in any other part of the cell's contents, eg it would delete the space from example turning it into example but where it found this example it would only delete the space from the beginning of the cell, not the space between the words. This is something that is possible in Word using a wildcard search, but not in Excel as the Find & Replace function is different. Could anyone help with this problem? Thank you. Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Spaces
Dim cel As Range
For Each cel In ActiveSheet.UsedRange If Left(cel.Value, 1) = " " Then cel.Value = Mid(cel.Value, 2) Next is one way, but you probably really want to use ltrim. This only gets one at a time. On Wed, 27 Aug 2003 03:28:58 -0700, "Steve Wylie" wrote: I also need another short macro that could go through an entire sheet deleting a space where it found it at the beginning of a cell, but not in any other part of the cell's contents, eg it would delete the space from example turning it into example but where it found this example it would only delete the space from the beginning of the cell, not the space between the words. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Spaces
That's excellent, thank you. And for your assistance
with the other macro too. Steve |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Spaces
Hi Steve
This will delete the first space from any cell on the activesheet in the usedrange Sub removeSpaces() Dim rng As Range With ActiveSheet For Each rng In .UsedRange If Left(rng.Text, 1) = " " Then rng = Replace(rng.Text, " ", "") End If Next End With End Sub -----Original Message----- I also need another short macro that could go through an entire sheet deleting a space where it found it at the beginning of a cell, but not in any other part of the cell's contents, eg it would delete the space from example turning it into example but where it found this example it would only delete the space from the beginning of the cell, not the space between the words. This is something that is possible in Word using a wildcard search, but not in Excel as the Find & Replace function is different. Could anyone help with this problem? Thank you. Steve . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I remove leading spaces and leave the remianing spaces w | Excel Worksheet Functions | |||
Spaces | Excel Worksheet Functions | |||
Adding Spaces to the end of a value | Excel Worksheet Functions | |||
spaces not recognized as spaces | Excel Worksheet Functions | |||
help with spaces in funtions | Excel Worksheet Functions |