Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

Run Macro on cell value

Hi,

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?

Thanks
Seamus
0
Seamus2626
Asked:
Seamus2626
  • 2
1 Solution
 
StephenJRCommented:
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
Protect
End If

End Sub

Open in new window

That is dynamic.
0
 
Seamus2626Author Commented:
Perfect, thanks Stephen!
0
 
StephenJRCommented:
My pleasure Seamus. Btw best not to use Protect as macro name as that is a name of a VBA method.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now