Run Macro on cell value

Posted on 2012-08-23
Last Modified: 2012-08-23

Is there code to run a macro if a cell contains a certain text string e.g. Complete

So if cell R31 = "Complete" run Macro Protect?

Question by:Seamus2626
    LVL 24

    Accepted Solution

    You could try some worksheet change code in the sheet module
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$R$31" And Target.Value = "Complete" Then
    End If
    End Sub

    Open in new window

    That is dynamic.

    Author Closing Comment

    Perfect, thanks Stephen!
    LVL 24

    Expert Comment

    My pleasure Seamus. Btw best not to use Protect as macro name as that is a name of a VBA method.

    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

    Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
    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…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

    729 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

    17 Experts available now in Live!

    Get 1:1 Help Now