Hi All,
I am looking to run a macro that clears a range of cells if one particular cell has the word "Leftout" in it. I have the below code but not sure how to run it properly as when i prompt to run it asks for a macro name, obviously I am missing something here.
So when Cell F20 has the word leftout in it i want to run the macro so it will then clear cells C19 to C29
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F20")) Is Nothing Then
If UCase(Range("F20")) = "Leftout" Then
Application.EnableEvents = False
Range("C19:C29").ClearContents
Application.EnableEvents = True
End If
End If
End Sub
thanks in advance
I am looking to run a macro that clears a range of cells if one particular cell has the word "Leftout" in it. I have the below code but not sure how to run it properly as when i prompt to run it asks for a macro name, obviously I am missing something here.
So when Cell F20 has the word leftout in it i want to run the macro so it will then clear cells C19 to C29
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F20")) Is Nothing Then
If UCase(Range("F20")) = "Leftout" Then
Application.EnableEvents = False
Range("C19:C29").ClearContents
Application.EnableEvents = True
End If
End If
End Sub
thanks in advance