activeX combo boxes - excel

I have a complex workbook that has a number of ActiveX Combo boxes which I choose over form controls for their customization options. Inexplicably, ALL of the boxes stopped working this morning. Literally, one minute they worked and then stopped completely. I was not working on that sheet, but rather a different one. There is no code attached to the combo boxes. When in design mode, the properties box doesn't even come up. Developer>Properties opens the worksheet properties only. This problem is not associated with the workbook because older versions of the same sheet are acting the same way. However, the compiled version of the workbook works fine. This suggests corruption in Excel somehow, so I repaired Excel (Office 365). No difference.
I deleted the combo box and replaced it and it is ok now, but that's not good enough for me. I have many others to remove and replace, but why do I need to do this? There are 180 other boxes that this happened to in the past and I simply used Data Validation for because I could not have this happen. I distribute this workbook in a compiled version only, so if I was certain that this bizarre occurrence could not happened once its compiled, I will replace all of the boxes that don't work and replace all of the data validation boxes with activeX, and compile it immediately. But I like things to make sense. What the heck is going on?

An ActiveX combo box has it's code on the sheet module for the sheet it is in. So, it's not odd that looking for the properties of the combo box that the sheet module would pop up. When in design mode and you right click on the combo box a pop up menu should come up that allows you to click and see the box's code on the sheet module. Are you saying that all the code for the boxes vanished or you had never written it? How do they get populated? I apologize for commenting in the answer section but I don't have enough points yet to write in the comment section.

The fact that no one has answered this suggests that this is behavior that I am causing. My belief at this point is that there is code running in the background which suspends other activity. I have a pop up calendar that ends with a range selection. I believe that this is looping somehow.
I am going to replace the data validation boxes with more combo boxes throughout the sheet with the calendar code in mind.

Related

Excel VBA Renaming ActiveX ComboBoxes Issue

I have a general question for which there are no code snippets. When an already existing worksheet ActiveX combo box has been renamed using VBA, why does the entire workbook need to be reopened in order for its name property to fully refresh/sync?
Is there a workaround that I am missing?
Also, a comment on the external link below notes a similar issue:
https://www.mrexcel.com/board/threads/vba-how-to-change-the-name-of-an-existing-combobox.1082608/
Example:
In this particular use case, I am looping through the OLEObjects collection and filtering specific OLEObjects into a standard collection. When i change the name property, I am referencing the standard collection items.
The name changes will reflect on the worksheet but not in the backend properties of the OLEObjects until the workbook is closed and reopened.
Well, it appears in the example, my code was lacking something. I was getting confused as to what was automatically occurring via Excel itself versus programmatically on my end.
UPDATE:
Another major cause of the problem, which I discovered via intensive debugging!!! If you rename any ActiveX combo box to include the "!" symbol, the boxes will experience issues when trying to communicate with any VBA events code - even after the boxes are renamed again later to not include such a symbol. Closing and reopening the workbook refreshes the bugs out of the combo boxes at that point.
If you try to add the "!" symbol to a regular event procedure name, you will receive an error. I am assuming this bug is inadvertently triggered by renaming the box to include that symbol. Warning: This may apply to other symbols but has not been tested. My situation was very unique in this case.
Another important point to emphasize: if your code involves renaming ActiveX combo boxes and any two or more boxes share the same name at some point throughout the code, this will cause a bug with any events code listening in the worksheet module until the workbook is closed/reopened. This bug occurs even if no two boxes share the same property name by the end of the procedure.

Excel - Disabel ability to manually change sheets (but don't hide them)

Apologies if this is a really stupid question but I've not been able to find a solution.
I've got a main page on my Excel workbook with a number of filter options and some buttons linked to vba code. When clicking the button it takes you another tab with a load of data filtered appropritately. There is a button there that removes the filters and takes you back.
This all works fine but what I want to do is stop people being able to manually change sheets but clicking on the tabs at the bottom of the screen. So far the only method I've found is hiding them, but this obviously doesn't work as you then can't see that data.
You can disable the editing of the sheet tab names by turning them off on the excel options as mentioned in the comment above. The downside to this approach is the user won't be able to see what sheet they are on (which I find incredibly frustrating).
The better method in my mind is to set up an event listener for when the user changes the name of the tab. You can then send a pop up box that appears when the user attempts to change the tab name.

Data Validation Drop Down Box Arrow Disappearing

I have recently been having issues in one of my Excel sheets, I have created a data validation drop down box that refers to a list in an adjacent column (unhidden).
Until today when I clicked on the cell, the drop down arrow appeared but now it briefly flashes before disappearing again, if you click on the right of the cell it still lets you make the selection but other people will use this sheet so it's not really acceptable.
I have checked that the data validation 'In-cell drop down' box is ticked and I don't know where to go from there, has anyone else had this problem? (Google has not been very helpful).
Thank you
I had the same problem and found out that this issue was in my case only related to the speed of the Excel Sheet itself. I had various linked pictures in the workbook that made it very slow, resulting as well in the data validation arrow issue.
Removing the linked pictures would improve the performance and resolve the issue.
(Previously I could resolve it with a workaround by creating a macro in "ThisWorkbook" that goes on two sheets and selects the fields with data validation activated when the workbook is launched:
Sheet("1").Range("DataValidation1").Select
Sheet("2").Range("DataValidation2").Select
Strange enough, this was sufficient to solve the problem.)
I've never personally seen this but have you tried it on another computer or as another user on your computer? I think it just might be some temp files or cache from office that is causing this issue.

Excel Listbox in a Sheet with FreezePanes

I have an Listbox Multiselect ActiveX control in a Sheet with Freeze Panes. The problem is that when I try to select items the mouseover icon is the standard excel cross instead of the arrow. I know that this question was asked before, but I didn't find any answer.
Thank u in advanced for help
I tested, and I came up with a few interesting observations.
In the ribbon, go to the developer tab. Make sure that the Design
Mode is not on.
When I first froze panes on the sheet, the freeze line went through the listbox I created. This caused the behavior you are describing with the cross-hairs and being unable to select.
Then I moved the listbox. Still same problem. I tried clicking on various cells around the sheet and in the ribbon area, with no change in behavior.
When I clicked to another sheet and back again, it started working as expected. Normal pointer mouse. I could select multiple, and unselect as needed.
Based on what I've tried, it seems that making sure Design Mode is off, and clicking to another sheet and back again may fix the problem.

Clicking/activating ActiveX control locks excel cell

I am encountering a small difficulty with an excel file I am working on. When moving from one sheet to another, the new activated sheet is sometimes locked in that sense that I can't make keyboard inputs. This seems to be the consequence of a interacting with a combobox or a listbox.
The issue also arises when I first click on the control and then try to change the content of the unlocked cell of the protected sheet. When the sheet is unprotected, the issue does not arise.
This seems to be resolved when I add this code on the control lostfocus event
debug.print selection.locked
Do ActiveX controls interfer with sheet protection or keyboard input (I can still use the dropdowns of those cell, select them with the mouse, etc.)
Any clue of how to resolve this without adding this mysterious line?
Thanks for your help!
If you have the formula bar hidden just turn it visible. I know it sounds wierd but it worked for me.

Resources