Hi Spritz,
I couldn't duplicate your error probably because I am using Excel 2003. When I selected top left, the count was 16,777,216. Yours is going to be a lot larger using Excel 2010 which may overflow the long integer variable type.
Try one of the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iCellCount As Long
On Error Resume Next
iCellCount = Target.Cells.Count
On Error GoTo 0
If iCellCount = 5 And Not Intersect(Target, Range("W5")) Is Nothing Then
Call frmcalendar.displayin(Range("W5"))
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iCellCount As Long
On Error Resume Next
iCellCount = Target.Cells.Count
If Err.Number <> 0 Then
On Error GoTo 0
Exit Sub
End If
On Error GoTo 0
If iCellCount = 5 And Not Intersect(Target, Range("W5")) Is Nothing Then
Call frmcalendar.displayin(Range("W5"))
End If
End Sub
Lewis
Bookmarks