Solved

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

Posted on 2014-12-21
4
73 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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 use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

733 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