I would like to add the below code to a worksheet1. It is only to execute when the user clicks on a shape (I know how to do this). I already have the code (see red) defined to sheet1. How do I accomplish this?
Sub Clearselected()
Range("e3").ClearContents
Range("e9", "e12").ClearContents
Range("H9", "H12").ClearContents
Range("i3", "i6").ClearContents
Range("K9", "K12").ClearContents
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
' Check to see if cell G3 updated
If Target.Address = Range("G3").Address Then
If Target.Value = "YES" Then
Application.EnableEvents = False
Range("E9:E12").Value = Range("J3:J6").Value
Application.EnableEvents = True
Else
If Target.Address = Range("G3").Address Then
If Target.Value = "NO" Then
Application.EnableEvents = False
Range("E9:E12").ClearContents
Application.EnableEvents = True
End If
End If
End If
End If
End Sub
Sub Clearselected()
Range("e3").ClearContents
Range("e9", "e12").ClearContents
Range("H9", "H12").ClearContents
Range("i3", "i6").ClearContents
Range("K9", "K12").ClearContents
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
' Check to see if cell G3 updated
If Target.Address = Range("G3").Address Then
If Target.Value = "YES" Then
Application.EnableEvents = False
Range("E9:E12").Value = Range("J3:J6").Value
Application.EnableEvents = True
Else
If Target.Address = Range("G3").Address Then
If Target.Value = "NO" Then
Application.EnableEvents = False
Range("E9:E12").ClearContents
Application.EnableEvents = True
End If
End If
End If
End If
End Sub