L
LauriS
Running 2000 - here's what I'm trying to do. I want an input box to appear
when the file is opened, prompting user for a date. Once they enter a date I
to search column A for the matching date then set the active cell to that
cell. I also want it to make sure they enter a valid date and if they don't
- go back to the input box and let them try again.
Here's what I have so far after reading through many of the great posts
already out here:
***************************************
Private Sub Workbook_Open()
Dim EnterDate As Date
Dim GoHere As Range
On Error GoTo addError
EnterDate = InputBox("Enter the Month and Year for the data being
entered (mm/yy)", "Enter MM/YY format")
Set GoHere = Columns("A").Find(what:=EnterDate, LookIn:=xlValues)
GoHere.Select
Exit Sub
addError:
MsgBox "This is not a date."
End Sub
*****************************
Two problems.
1. The code, as it is, goes to the error section even when I enter a valid
date. When I try to use the immediate window to check the value of GoHere I
get the message: Runtime error 91: Object variable or With block variable
not set. I don't understand why I'm getting that message.
2. If they don't enter a valid date it displays the error message and
stops. How do I make it go back to the input box and allow them to try again
(and again and again if necessary)?
As always, thanks for any help you can offer!!
Lauri S.
when the file is opened, prompting user for a date. Once they enter a date I
to search column A for the matching date then set the active cell to that
cell. I also want it to make sure they enter a valid date and if they don't
- go back to the input box and let them try again.
Here's what I have so far after reading through many of the great posts
already out here:
***************************************
Private Sub Workbook_Open()
Dim EnterDate As Date
Dim GoHere As Range
On Error GoTo addError
EnterDate = InputBox("Enter the Month and Year for the data being
entered (mm/yy)", "Enter MM/YY format")
Set GoHere = Columns("A").Find(what:=EnterDate, LookIn:=xlValues)
GoHere.Select
Exit Sub
addError:
MsgBox "This is not a date."
End Sub
*****************************
Two problems.
1. The code, as it is, goes to the error section even when I enter a valid
date. When I try to use the immediate window to check the value of GoHere I
get the message: Runtime error 91: Object variable or With block variable
not set. I don't understand why I'm getting that message.
2. If they don't enter a valid date it displays the error message and
stops. How do I make it go back to the input box and allow them to try again
(and again and again if necessary)?
As always, thanks for any help you can offer!!
Lauri S.