object variable not set problem

grunschlange

New Member
Joined
Sep 12, 2009
Messages
13
Hello.

I have the following code that keeps giving me an "object variable or With block variable not set" error:

Sub test12()

Application.ScreenUpdating = False
Application.DisplayAlerts = False


Dim x As String
x = InputBox(Prompt:="Enter the Web ID.", Title:="ID Input")
Windows("Intake-November-11.xls").Activate
Sheets(1).Select
Cells.Find(What:=x).Select


Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

I am trying to run this from a worker workbook called "Simon-November-11" in a sheet-level macro. It is in a sheet-level module because "Simon" and the other worker workbooks are created from the master "Intake" workbook, and I need to have some macros available for the workers to enter ID numbers to get cases to work from the master file. The first part of my project is entering an ID# and having a macro find the cell with that #. Later, I will copy parts of the row with the # and paste them in the worker file.

The problem I am having is that every time I test this, I get the "object variable" error. Can you help me understand what I am missing? I have searched several examples and can't seem to find a good solution.

Let me know if you need more information for this.
Thanks.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
It could be because Find isn't finding anything, so the code can't select anything.

If Find doesn't find anything it returns Nothing.:)
 
Upvote 0

Forum statistics

Threads
1,203,105
Messages
6,053,546
Members
444,670
Latest member
laurenmjones1111

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