calendar control in 3 columns

G

Guest

If I change the range to include 2 columns it still works

If Not Application.Intersect(Range("A2:A200", "F2:F200"), Target) Is Nothing
Then


But if I add a third it doesn't work... is there a way to make it?

If Not Application.Intersect(Range("A2:A200", "F2:F200", "G2:G200"), Target)
Is Nothing Then


here is the starting code:

Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
' ActiveCell.NumberFormat = "dd/mmm/yy"
ActiveCell.Select
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("A2:A200"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub
 
R

Ron de Bruin

Hi tmirelle

See the example on my site

Note: you can use this if your range is not one area
If Not Application.Intersect(Range("A1:A20,C1,E1"), Target) Is Nothing Then
 
G

Guest

Thanks!

Ron de Bruin said:
Hi tmirelle

See the example on my site

Note: you can use this if your range is not one area
If Not Application.Intersect(Range("A1:A20,C1,E1"), Target) Is Nothing Then
 

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