RunTime 91 error

julhs

Active Member
Joined
Dec 3, 2018
Messages
407
Office Version
  1. 2010
Platform
  1. Windows
I am stumped as to why the 1st of the 2 Change Events below in one Workbook works without problems. But the 2nd one, in another Workbook causes a RunTime 91 error when I close the Workbook?

Private Sub ComboBox1_Change()
Dim wt As Worksheet
Set wt = ThisWorkbook.ActiveSheet
ActiveSheet.[e4].Select
End Sub


Private Sub ComboBox1_Change()
Dim wt As Worksheet
Set wt = ThisWorkbook.ActiveSheet
ActiveSheet.[i7].Select
End Sub
 
My apologies, my problem is with some of VDA terminologies. The code for the change event DOES reside in Worksheet module ( or as I think of it, “IN / ON” the sheet)

EMBED("Forms.ComboBox.1","") is just an ActiveX form.

Yes it is exactly the same. I copied and pasted the whole ComboBox and did the same for the “Change event” code and then changed the cell ref# to "I7"

I have tried your alternative now, giving Runtime 1004 error

I’m beginning to think the Workbook itself is corrupted?
So my only thought is to copy out the contents of the Worksheet to a new book??
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I’m beginning to think the Workbook itself is corrupted?
So my only thought is to copy out the contents of the Worksheet to a new book??
That is a possibility. I believe that ActiveX components can be a little flaky, and could be a security risk.
Is there some reason you have to use ActiveX Controls, instead of Excel's built-in Form Controls? Except for a calendar, that is what I always use.
 
Upvote 0
Hi Joe4

I use ActiveX Combox’s all the time; have in region of 40 split over numerous Workbooks without a single issue until now, that is what’s so strange!

I feel they have more scope in themselves, they are stand alone (no need for additional Macros to achieve what I want), have more range of formatting and you can “Enter” values into the ActiveX Combox’s window if you wish.

Security is not an issue as the Workbooks are not shared.

I have experimented with clearing out the ENTIRE problem sheet of EVERYTHING except the “ActiveX Combo’s” and the issue remains!

While I could change the “ActiveX Combo’s to “Form Combo” and use a Macro to do the equivalent of the “Change event”. But that is not solving the problem as to why/how this is happening in ONLY this Workbook??
 
Upvote 0
Well I’ve at least now ascertained that; all my “ActiveX Combo’s with a “Change event” assigned to them, that work WITHOUT a Runtime Error are ALL set to “BoundColumn 1 & ColumnCount 1” in their properties.

Whereas the Runtime Error issue is where they are set to “BoundColumn 2 & ColumnCount 2” because I wanted the Combo to display 2 columns of the range list and place the data from the 2nd in another cell

Need to rethink things!!
 
Upvote 0
FINALLY CRACKED IT !!!!, it was simply a matter of changing “Private Sub ComboBox1_Change()” to “Private Sub ComboBox1_Click()”. NO MORE RunTime 91 error when closing the Workbook, so simple in the end!!
 
Upvote 0
Solution
Thanks for posting back to the solution.
Glad you were able to figure it out.
Not using the ActiveX controls, I did not know that.
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,668
Members
448,977
Latest member
moonlight6

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