G
gary
How can I search a cell to find the first two consecutive spaces?
gary said:How can I search a cell to find the first two consecutive spaces?
x = InStr(ActiveCell.Formula, " ")
If the formula is "a b c d e", then x = 4.
Here's my data:
Col C
1 HILL KENNETH E III
2 HILL KENNETH E III
3 VAN SMAALEN FAMILY TRUST
4 VAN SMAALEN FAMILY TRUST
5 EXECUTIVE ENT
6 PASQUALETTO RICHARD LEE
7 JUICE MAN
8 JUICE MAN
9 HAMER JAMES R
10 HAMER JAMES R
What syntax would your formula have to identify cells C1, C2, C6, C9
and C10 as having two consective spaces?
gary said:Here's my data:
Col C
1 HILL KENNETH E III
2 HILL KENNETH E III
3 VAN SMAALEN FAMILY TRUST
4 VAN SMAALEN FAMILY TRUST
5 EXECUTIVE ENT
6 PASQUALETTO RICHARD LEE
7 JUICE MAN
8 JUICE MAN
9 HAMER JAMES R
10 HAMER JAMES R
What syntax would your formula have to identify cells C1, C2, C6, C9
and C10 as having two consective spaces?
In the line I posted, if x is greater than 0 (zero), there is a run of *at
least* 2 consecutive spaces:
x = InStr(ActiveCell.Formula, " ")
If x Then MsgBox "There are two spaces in cell " & ActiveCell.Address
(Don Guillett's code does essentially the same thing, once you get past
Google's mangling of his line feeds.)
What *exactly* are you trying to accomplish? Be specific.
In the line I posted, if x is greater than 0 (zero), there is a run of *at
least* 2 consecutive spaces:
x = InStr(ActiveCell.Formula, " ")
If x Then MsgBox "There are two spaces in cell " & ActiveCell.Address
(Don Guillett's code does essentially the same thing, once you get past
Google's mangling of his line feeds.)
What *exactly* are you trying to accomplish? Be specific.
gary said:I want to know if the cell contains two consecutive spaces.
For example:
HILL KENNETH E III does
VAN SMAALEN FAMILY TRUST does not