Range Problem in VBA

  • Thread starter Thread starter Worzel Gummidge
  • Start date Start date
W

Worzel Gummidge

I currently have the following VBA code so that a calendar appears in cell
HG:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$H$6" Then
Cancel = True
Call OpenCalendar
End If
End Sub
_____________________

This code works great and inserts the relevant date into the cell etc...
Nonetheless, I want to ammend this code so that I can double click on any
cell within the range H6:H1000 (as opposed to only Cell H6) and the calendar
will pop up and the user can select a date and it will be entered into the
cell.

Any ideas?
 
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Range("H6:H1000")) Is Nothing Then
Cancel = True
Call OpenCalendar
End If
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Cheers Bob

Problem solved

Bob Phillips said:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Range("H6:H1000")) Is Nothing Then
Cancel = True
Call OpenCalendar
End If
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Back
Top