Run Macro based on cell change

B

Binaface

Is it possible to run a macro based on a change in a particular cell (ie.
cell color changes) that would automatically trigger a macro that would cut
the entire row that the cell is in, and then paste it in a new sheet? I have
tried running a macro by recording the action, but it does not seem to
function...

Thank you all!
 
J

JLGWhiz

Color change is a formatting function and VBA does not recognize formatting
as an event. However, It is possible to evaluate the color of a cell and if
it is, or is not, a certain color, then initiate some action. You could use
the Worksheet_SelectionChange event to trigger the evaluation.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Interior.ColorIndex = 3 Then
MsgBox "YES"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top