wwbwb
Well-known Member
- Joined
- Oct 20, 2003
- Messages
- 513
The following code works just fine when running Excel 2002. It is called duing a workbook_open event.
When I run it as a macro in Excel 97 it works also.
But... when I have it called during a workbook_open event in Excel 97, it runs the code (just fine) and when it tries to finish, then Windows(XP) says "ugh uh" and shuts down excel asking me to send/not send and debug. If I try to debug to find out what is wrong... nothing happens. If I don't have this called during the workbook_open event, everything is just perfect. Anyone have any ideas???
When I run it as a macro in Excel 97 it works also.
But... when I have it called during a workbook_open event in Excel 97, it runs the code (just fine) and when it tries to finish, then Windows(XP) says "ugh uh" and shuts down excel asking me to send/not send and debug. If I try to debug to find out what is wrong... nothing happens. If I don't have this called during the workbook_open event, everything is just perfect. Anyone have any ideas???
Code:
Sub reminder()
Application.ScreenUpdating = False
Dim dates As Date
Dim LastRow As Long
With Sheets("Reminders")
Columns("A:B").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A2").Select
dates = Date
LastRow = Range("a65536").End(xlUp).Row
For Each c In Range("a2:a" & LastRow)
If c = dates Then
MsgBox c.Offset(0, 1), , "Reminder for " & c
End If
If c < dates Then
response = MsgBox("The following entry is past due." & Chr(13) & c & " - " & c.Offset(0, 1) & _
Chr(13) & "Do you want to delete it?", vbYesNo, "Past Due")
If response = vbYes Then
c.EntireRow.ClearContents
Else
End If
End If
Next c
End With
End sub