Im trying to make a vba program that will open specific userform by clicking specific cells. I have two forms Userform1 and UserForm2 that I want to show on the same Worksheet when a user click specific cell. Example; when Range("A1") is doubleclicked show UserForm1, when Range("A5") is doubleclicked show UserForm2.
I tried the code below but it only works for Range("A1") and Userform1. I dont know how to add for Range("A5") and Userform2.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Double click
If Not Application.Intersect(Target, Worksheets("Sheet1").Range("A1")) Is Nothing Then
Cancel = True
UserForm1.Show
End If
Please help. Thanks.
I tried the code below but it only works for Range("A1") and Userform1. I dont know how to add for Range("A5") and Userform2.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Double click
If Not Application.Intersect(Target, Worksheets("Sheet1").Range("A1")) Is Nothing Then
Cancel = True
UserForm1.Show
End If
Please help. Thanks.