I have a sheet where I open a userform, when RIGHTclicking on any cell A3:A10.
Now, I want to load the userform not by rightclicking, but by merely CLICKING on any cell A3:A10.
See the image.
Here is my code:
Now, I want to load the userform not by rightclicking, but by merely CLICKING on any cell A3:A10.
See the image.
Here is my code:
VBA Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim i, nrow As Integer
i = ActiveCell.Row
nrow = Cells(3, 1).End(xlDown).Row 'sets the last used row
If i > 2 And i < nrow + 1 Then
If Target.Column = 1 Then
UserForm5.Show
Cancel = True
Else
Cancel = True
End If
Else
Cancel = True
End If
End Sub