VBA .Interior.Color.Red then enter text...

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,124
Office Version
  1. 365
Platform
  1. Windows
Good Day All,

If I'm working with cell E11:E180 where its interior color turns red through CF.

Now, how do I provide through VBA where if this cell's interior color turns red that the text appears "RED"?



As in:


Capture5.jpg


Please let me know as soon as you can thank you!

R/
pinaceous
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
If you set the cell colour to red with cf, then why not just set the font to be red in the same format settings?
 
Upvote 0
If you set the cell colour to red with cf, then why not just set the font to be red in the same format settings?
CF cannot provide text back from a cell. I wanted the actual text "RED" to return back from the interior color that appears. I do not want the font to be red.

For example, if I wanted the actual text to return "TEXT" in response of the interior color change of red it would appear for that cell:

Capture6.jpg
 
Upvote 0
Since you are using CF, I assume the interior color will change when editing the cell.
What is the CF rule that you have ?
 
Upvote 0
Hi Jaafar!

I'm using
Excel Formula:
=AND(AF11="",AE11<>"")
applying to
Excel Formula:
 =$E$11:$E$180

As in:

Capture1.PNG


Capture2.jpg



Do you have any suggestions on how I can add text to this interior color in using the cf formula?

Thanks,
pinaceous
 
Upvote 0
Yes, it applies to cell E11.

Sorry for the confusion!
If I understand correctly, what you are trying to do is contradictory.
the CF rule says that the cell color turns red if the cell is empty ... Now, if you add the text "RED", the cell will no longer stay empty so the cell color will no longer be red!
 
Upvote 0
Okay, I understand thanks Jaafar! I'll look into a vba approach to see if "Text" can be added ect.
 
Upvote 0
Yes, you will have to ditch the CF. VBA might be something like
VBA Code:
If Range("E11")="" And Range("F11")<>"" Then
    With Range("E11")
        .Interior.Color = vbRed
        .Value = "RED"
    End With
End If
 
Upvote 1
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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