ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Counting blanks in a string (https://www.excelbanter.com/excel-programming/293488-counting-blanks-string.html)

xnman

Counting blanks in a string
 
In VBA, I know there is a simple way of counting blanks in a string, but
I can't remember it. Anyone know how to do this?

thanks
xnman


Frank Kabel

Counting blanks in a string
 
Hi
one way:
len(your_str)-len(replace(your_str," ",""))

--
Regards
Frank Kabel
Frankfurt, Germany
"xnman" schrieb im Newsbeitrag
...
In VBA, I know there is a simple way of counting blanks in a string,

but
I can't remember it. Anyone know how to do this?

thanks
xnman



Vasant Nanavati

Counting blanks in a string
 
Len(MyString)-Len(WorksheetFunction.Substitute(MyString," ",""))

--

Vasant



"xnman" wrote in message
...
In VBA, I know there is a simple way of counting blanks in a string, but
I can't remember it. Anyone know how to do this?

thanks
xnman





All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com