View Full Version : Solved: Open User Form in specified range

05-12-2008, 03:52 AM
Hi All,

I've attached a test workbook with a form that I'm using to pick the time/date and this is the the code using to open the form in the range B3:E18.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("B3:E18")) Is Nothing Then
End If

I want the form to to open when you double click the left mouse botton or hit the enter the botton in the range B3:E18 because at the moment it's annoying that the form opens when click in the range by mistake.

P.S. Feel free to play around with the form because I feel it can be made to work better.

Many thanks


05-12-2008, 04:18 AM
I would stick with the double-click event, rather than trapping the Enter key:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("B3:E18")) Is Nothing Then
Cancel = True
End If
End Sub


05-12-2008, 04:56 AM
Thank you Rory,

the code works well and I think you are right about using only the double-
click option.