Range Problem in VBA

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?
 
B

Bob Phillips

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)
 
W

Worzel Gummidge

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top