Faux
Faux

Reputation: 103

If selected cell is colored

Is it possible to do, that if you select a cell, and it is colored red, a MsgBox would pop out?

I tried something like this:

Sub isitred()
    If ActiveCell = "vbRed" Then
        MsgBox "ActiveCell is Red"

    End If
End Sub

But it doesnt work... Any ideas?

Upvotes: 0

Views: 1035

Answers (1)

Jeremy
Jeremy

Reputation: 4848

You can try:

If ActiveCell.Interior.Color = vbRed Then
  MsgBox ...
End If

If vbRed is not defined, you can use the value of 255.

Upvotes: 2

Related Questions