Testing multiple cells for any text in cell

bergen

New Member
Joined
Sep 28, 2011
Messages
31
I am trying to fill some autoshapes with color if any text is entered into specific cells. This works just fine if numbers are entered, but doesn't work if letters are used, I have looked at some possible solutions but they all seem very complex, is there any way to easily transform below into testing for letters rather than numbers? (I have a very big code to correct)

Here is part of the code (which only Works with numbers):

If Range("C23") Or Range("C60") Or Range("C82") Or Range("C104") <> "" Then
ActiveSheet.Shapes("Cirkel 8").Fill.ForeColor.RGB = vbGreen
ActiveSheet.Shapes("Cirkel 9").Fill.ForeColor.RGB = vbGreen
ElseIf Range("C11") Or Range("C48") Or Range("C70") Or Range("C92") <> "" Then
ActiveSheet.Shapes("Cirkel 8").Fill.ForeColor.RGB = vbYellow
ActiveSheet.Shapes("Cirkel 9").Fill.ForeColor.RGB = vbYellow
Else
ActiveSheet.Shapes("Cirkel 8").Fill.ForeColor.RGB = RGB(166, 166, 166) 'grey
ActiveSheet.Shapes("Cirkel 9").Fill.ForeColor.RGB = RGB(166, 166, 166) 'grey
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi, you need to repeat the logical test in each Or section.

For example:

Code:
If Range("C23") <> "" Or Range("C60") <> "" Or Range("C82") <> "" Or Range("C104") <> "" Then
 
Upvote 0
You may also be able to use ..
Code:
If Len(Range("C23") & Range("C60") & Range("C82") & Range("C104")) Then
 
Last edited:
Upvote 0
Thank you very much for the replies both of you. FormR for making me understand my error and Peter_SSs for providing a sharper alternative!
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top