run-time error '91' object variable or block variable not set

TRosseter

New Member
Joined
Jul 26, 2013
Messages
22
when I open up the spread sheet aiiwwaxexcel0 the code runs fine and all is good but if I open up any other or new workbook I get this run time error any ideas?

code below
'Private Sub Workbook_Open()
'Select Case ActiveWorkbook.Sheets("aiiwwaxexcel0").Range("A3").Value
'Case "History"
'History_Order_Guide_Without_Pricing2
'Case "ItemBrowse"
'Order_Guide_With_Pricing2
'Case Else
'End Select
'End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Change ActiveWorkbook to ThisWorkbook.
 
Upvote 0
What do you mean open 'aiiwwaxexcel0'?

I thought that was a worksheet?

Where do you get the error?

Where is this code located?
 
Upvote 0
What do you mean open 'aiiwwaxexcel0'? this is a worksheet named: aiiwwaxexcel0
Where do you get the error? when I open up any excel documents
Where is this code located? located in my personal.xlsb file in the thisworkbook object

the code works if I use activesheet or select case range("a3") thisworkboodk code does not work
 
Upvote 0
What is the code meant to do and why is it in personal.xlsb?

By the way, you can't 'open' a worksheet.

PS Where, not when, do you get the error?
 
Upvote 0
if I open up excel I want it to check range a3 and if it matches a word then I want it to run a macro in my personal.xlsb file.

when I open up excel a MS vb message box pops up and in the box it has the run time error "91" I click on the debug button, its yellow on the 'Select Case thisWorkbook.Sheets("aiiwwaxexcel0").Range("A3").Value line of code
 
Upvote 0
Why is the code located in personal.xlsb?

Does personal.xlsb have a worksheet called 'aiiwwaxexcel0'?

Which workbook/workbooks have that sheet?
 
Upvote 0
worksheet is auto names 'aiiwwaxexcel0' when I export it.

*.xlsb is where I can access a macro when its not in the document.

when I export an excel document from my software it creates a file "aiiwwaxexcel0" and then I can click on macros and run a macro from my personal.xlsb file;
this macro formats the document. I want this private sub workbook_open to check for a keyword in "a3" example history, item, customer then run a macro in from my personal.xlsb file. I can get it to work but the issue is when no info or non matching info then I get an error message:
run time error '9' subscript out of range
 
Upvote 0
I'll ask again, why is the code in Personal.xlsb?

Because it is, every time Personal.xlsb is opened, which is every time you open Excel, the code wil run.s
 
Upvote 0

Forum statistics

Threads
1,216,583
Messages
6,131,557
Members
449,655
Latest member
Anil K Sonawane

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