run time error 91 object variable or withblock variable not set in VBexcel

SWARAJG

New Member
Joined
Feb 26, 2012
Messages
4
Hi,

Can anyone help me solving the issue mentioned below.

Following is the subset of code for which I'm getting runtime time error 91:

StartTime = InputBox("Enter the Start time in hh:mm:")
EndTime = InputBox("Enter the End time in hh:mm:")

Selection.Find(What:=StartTime, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Temp = ActiveCell.Row

Range("C" & (Temp - 1)).Select
'startrow = ActiveCell.Row

Range(Selection, Cells(1)).Select
Selection.EntireRow.Delete
Range("A1").Select

Columns("C:C").Select

Selection.Find(What:=EndTime, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate



Now for starttime I am not getting this error but while searching endtime I am getting runtime error 91
 
It's because the Find has failed to find EndTime.

That could be for a no of reasons, it might not actually be there to find, a problem with data types, you aren't using the correct arguments in the Find etc

It's hard to tell what the problem is without knowing more.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top