Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
# of Spaces macro
is there a way to write a macro that looks at a field of
data and counts the number of spaces in it. i.e.: Field 1 |Dave Jones 2100 Wind Street Anytown AK 11021| So I would want the macro to recognize there being "7" spaces in this record and based on that place it into a specific worksheet. Any help is greatly appreciated. thank you. Peter. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
# of Spaces macro
Hi
do you need a VBA solution or would a worksheet formula work as well?. For the latter one try =LEN(A1)-LEN(SUBSTITUTE(A1," ","")) -- Regards Frank Kabel Frankfurt, Germany "Peter" schrieb im Newsbeitrag ... is there a way to write a macro that looks at a field of data and counts the number of spaces in it. i.e.: Field 1 |Dave Jones 2100 Wind Street Anytown AK 11021| So I would want the macro to recognize there being "7" spaces in this record and based on that place it into a specific worksheet. Any help is greatly appreciated. thank you. Peter. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
# of Spaces macro
len(sStr) - len(replace(sStr," ",""))
use application.Substitute if using xl97 or earlier. -- Regards, Tom Ogilvy "Peter" wrote in message ... is there a way to write a macro that looks at a field of data and counts the number of spaces in it. i.e.: Field 1 |Dave Jones 2100 Wind Street Anytown AK 11021| So I would want the macro to recognize there being "7" spaces in this record and based on that place it into a specific worksheet. Any help is greatly appreciated. thank you. Peter. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
# of Spaces macro
thanks to both of you for the help. i appreciate your
sharing of knowledge -----Original Message----- is there a way to write a macro that looks at a field of data and counts the number of spaces in it. i.e.: Field 1 |Dave Jones 2100 Wind Street Anytown AK 11021| So I would want the macro to recognize there being "7" spaces in this record and based on that place it into a specific worksheet. Any help is greatly appreciated. thank you. Peter. . |
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 not recognized as spaces | Excel Worksheet Functions | |||
Macro that double spaces rows for an entire worksheet? | Excel Discussion (Misc queries) | |||
Need simple little macro - edit add 3 spaces | Excel Worksheet Functions | |||
macro to eliminate spaces between words | Excel Discussion (Misc queries) |