Find cells without multiple spacebars and format...
It's this statement that's the problem. Evidently you are thinking of COUNTIF
and SUMIF, which accept wild cards. A direct comparison does not.
If Cells(i, "a").Value < " *" Then
You could write this as
If Cells(i, "A").Value LIKE " *" Then
or
If Left$(Cells(i, "A").Value, 5) = " " Then
On Wed, 26 Jan 2005 21:27:01 -0800, "BeSmart"
wrote:
Thanks for that....
I tried the revised code as suggested, and I made sure there were definitely
5 spaces before the asterik in the code.
But I got the same result, ie all rows became bold....
Any other ideas????
Regards
BeSmart
"gocush" wrote:
try adding a "Step -1" to work from the bottom up
Dim i
For i = Cells(Rows.Count, "a").End(xlUp).Row to 1 Step-1
If Cells(i, "a").Value < " *" Then
Cells(i, "a").Font.FontStyle = "Bold"
End If
Next
Also - important- when I deleted the spaces in front o your asterisk I only
found 4 spaces in your code. I think the above has 5.
"BeSmart" wrote:
(Re-posting. Sorry - I posted it in the Excel General section
accidentally)
Hi all (warning novice approaching)....
I'm writing VBE code and I want to find cells in column A where the text
entered does not start with 5 spacebars eg:
Alligators aren't always aggressive...
Blue bulls blow big...
Great grapes grow ....
Pink pigs put purple....
In the above example I need the code to pick up the "The quick brown
Fox...." row and the "Great grapes grow..." row and make them bold. The
"Blue Bulls" row and the "Pink pigs" row stay unbold.
I've tried the following code but it makes all active cells bold..
What am I doing wrong? Any help would be greatly appreciated.
......
Dim i
For i = 1 To Cells(Rows.Count, "a").End(xlUp).Row
If Cells(i, "a").Value < " *" Then
Cells(i, "a").Font.FontStyle = "Bold"
End If
Next
Thank for your help
BeSmart
|