Solved

How to call a macro when a cell goes from black text to red text

Posted on 2014-12-21
4
68 Views
Last Modified: 2014-12-24
I have macro's in place to manually run if certain cells have red text. Is there a way to call a macro w/o manual intervention when a cells text changes from black to red?
Thanks
0
Comment
Question by:dgd1212
  • 2
4 Comments
 
LVL 33

Expert Comment

by:Norie
ID: 40511568
How/why are you changing the cell colour?
0
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40511570
hI

You can do something like below:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim lRow As Long
Dim iCntr As Long
lRow = 20
For iCntr = lRow To 1 Step -1
If Cells(iCntr, 1).Font.ColorIndex = 3 Then
CommandButton1.Value = True
End If
Next
End Sub

Open in new window

0
 
LVL 11

Accepted Solution

by:
Wilder1626 earned 500 total points
ID: 40511591
Another way could also be:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim t As Range
If Not Intersect(Target, Range("A1:A" & Rows.Count)) Is Nothing Then
         Set Rng = Intersect(Target, Range("A1:A" & Rows.Count))
         For Each t In Rng
             If t.Font.ColorIndex = 3 Then
              CommandButton1.Value = True
            End If
         Next t
End If
End Sub

Open in new window

0
 

Author Closing Comment

by:dgd1212
ID: 40516451
Thanks!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now