ADJ Macro Worksheet Selection change event Hi, How could this worksheet change e
ID: 3565353 • Letter: A
Question
ADJ Macro Worksheet Selection change event
Hi,
How could this worksheet change event could include two macro, as each sheet must have one named as worksheet change event. The space after "Unload me" and "On error resume Next" between these two I tried using end if but that does not work.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Intersect(Target, Range("G3:G36")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
UserForm1.Show
Unload Me
On Error Resume Next
If Intersect(Target, Range("J3:J36")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
UserForm1.Show
Unload Me
End Sub
Thanks
Explanation / Answer
Unload Me is only valid in the module of a userform, not in a worksheet module.
You could use
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Intersect(Target, Range("G3:G36,J3:J36")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
UserForm1.Show
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.