dmacdougall
New Member
- Joined
- Oct 18, 2005
- Messages
- 43
OK, I want to check through multiple columns and rows for dates which may have passed, so I can be notified when I open the workbook. Why does the following code give me a Type Mismatch error when I attempt to fill the "datDateCheck" variable? Help! dm
Private Sub Workbook_Open()
'This sub displays a MsgBox if any items are past due
Dim intRnwlCounter As Integer
Dim aryRnwlArray(7) As String <-- Perhaps this should be Variant?
Dim datDateCheck As Date
Dim intArrayCounter As Integer
intRnwlCounter = 1
intArrayCounter = 0
aryRnwlArray(0) = "G"
aryRnwlArray(1) = "K"
aryRnwlArray(2) = "O"
aryRnwlArray(3) = "S"
aryRnwlArray(4) = "W"
aryRnwlArray(5) = "AA"
aryRnwlArray(6) = "AE"
For intArrayCounter = 0 To 6
For intRnwlCounter = 1 To 100
datDateCheck = Worksheets("Appointments").Cells _
(intRnwlCounter, (aryRnwlArray(intArrayCounter))) <-- Type
Mismatch
error occurs
here!
If datDateCheck < Now() And datDateCheck > 0 Then
MsgBox ("You have expired appointments which should be renewed!"), _
Buttons:=48
Exit Sub 'Exits when first expired appointment found
Else
End If
Next
Next
End Sub
Private Sub Workbook_Open()
'This sub displays a MsgBox if any items are past due
Dim intRnwlCounter As Integer
Dim aryRnwlArray(7) As String <-- Perhaps this should be Variant?
Dim datDateCheck As Date
Dim intArrayCounter As Integer
intRnwlCounter = 1
intArrayCounter = 0
aryRnwlArray(0) = "G"
aryRnwlArray(1) = "K"
aryRnwlArray(2) = "O"
aryRnwlArray(3) = "S"
aryRnwlArray(4) = "W"
aryRnwlArray(5) = "AA"
aryRnwlArray(6) = "AE"
For intArrayCounter = 0 To 6
For intRnwlCounter = 1 To 100
datDateCheck = Worksheets("Appointments").Cells _
(intRnwlCounter, (aryRnwlArray(intArrayCounter))) <-- Type
Mismatch
error occurs
here!
If datDateCheck < Now() And datDateCheck > 0 Then
MsgBox ("You have expired appointments which should be renewed!"), _
Buttons:=48
Exit Sub 'Exits when first expired appointment found
Else
End If
Next
Next
End Sub