lydiapenrose
New Member
- Joined
- Nov 7, 2011
- Messages
- 22
Hi. So I wrote the code below. It's really simple. I am trying to have it so users can input the start date of a work week. The code then finds this date and eventually I plan to use offset to copy and past and sum diferent work hours into a format that we need for weekly presentations.
However, when I try to run it, the input box comes up fine and then after I input my date, I get Run Time Error '91': Object variable or With block variable not set. I tried researching this error but I haven't set any objects/don't understand what I'm doing wrong. Please help! My code is below. Thanks
Sub Timesheet()
'
' Macro1 Macro
'
Dim DateEntry As String
DateEntry = InputBox("Enter the first date in your five day date range in the format mm/dd/yyyy.", "Beginning Date")
'
Cells.find(What:="DateEntry", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End Sub
However, when I try to run it, the input box comes up fine and then after I input my date, I get Run Time Error '91': Object variable or With block variable not set. I tried researching this error but I haven't set any objects/don't understand what I'm doing wrong. Please help! My code is below. Thanks
Sub Timesheet()
'
' Macro1 Macro
'
Dim DateEntry As String
DateEntry = InputBox("Enter the first date in your five day date range in the format mm/dd/yyyy.", "Beginning Date")
'
Cells.find(What:="DateEntry", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End Sub