Excel combo box - excel

I have a workbook that has a combo box list in it and works fine until I try to share
the book, then it stops working. I have since found out that this is how Excel is set up!
I have a validation list that works but will only show 8 lines whereas the combo will show all 22 lines at once, which is what I was trying to achieve.
Can I use a form control to work around this and if so how do I do it ?

I have just tested this, adding an ActiveX Combo-box to a sheet, linking it to a list of cells and sharing the workbook, the Combo-box drop down is unaffected.
If you are trying to insert a combo-box to an already shared workbook, then the insert menu will be greyed out, to do this you must open the workbook in exclusive mode by going to Review > Share Workbook and deselecting the share tick box.
Once you have it open in exclusive mode you can then add in the combo-box and re-share.

Related

How to remove invallid entries from macro list?

In Excel, when opening the list of macros, there are some invalid entries. How to get rid of them?
Background:
I have an extended VBA library, containing a lot of UDFs and subs. I have added descriptions for UDFs using macro options. Maybe i created these invalid entries accidently in the past by a sub, which parses my code modules and generates descriptions for UDFs if this is provided via comments in the code module. This works fine now.
The invalid entries are actually the names of UDFs which do not exist anymore. They should not have appeared unter macros at any time, but again, maybe I messed up in the past.
I also would like to add some description to macros that do exist - but apparently that is only possible for UDFs?
Clarifications:
There is only this one workbook open. These are not macros of a different workbook. I selected "This Workbook only" for list of macros anyway.
There are no addins.
In VBE under Macros these invalid entires do NOT appear.
In Excel, under Developer Tools->Macros they DO appear.
In Excel, under Developer Tools->Macros, I can not edit or delete or execute these entries. Delete is greyed out, edit and execute lead to a popup error saying: "Der Bezug ist ungültig."
If you are referring to the Macro dialog that opens when clicking View > Macros, then note that there is a drop-down with which you can filter to show macros from a particular workbook only.
Use this to find where the "invalid" macros live, then edit that workbook and handle the macros from there (fix them or remove them).
The Macro dialog box that opens from the Developer tab lists all macros in "All open workbooks" by default. In the dropdown that shows this selection you can select to show macros in only a specific workbook. The reverse of this coin is that you can know exactly where any listed macro is located.
There are buttons to the right of the list which allow you to Edit or Delete any of the listed macros. The Edit button will take you to the module where the macro is stored.
There is also an Options button. When you click that another dialog box opens where you can set shortcuts as well as add a description. You can add a description to any listed macro, whether it's used as UDF or otherwise.
I wonder what would happen if a description exists for a macro that has been deleted. If such a situation is supported by Excel pressing the Delete button should rectify it.
I found an answer on microsoft.com:
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_winother-mso_2016/cannot-delete-macros/8e9072ae-ad95-49cb-952c-3a50b746d0d2
So it appears my workbook got somehow "corrupted". As I said, I did play with it quite a bit during development. So what I did to fix it:
Export all code modules.
Save workbook as .xlsx under a different name.
Open this cleaned xlsx and save it as xlsm again.
Imported all code modules into this cleaned xlsm.
Manually copied code in worksheet from corrupted version to clean version.
Now the macros are gone in the cleaned version.

When two Excel workbooks are open, each with VBA code, how do I switch the code view between workbooks?

I have two Excel workbooks, each with VBA code. However, the code window (in response to Alt-F11) only displays the VBA code associated with one workbook. I tried entering Alt-F11 again but, while the label at the top of the code window toggles between my two different spreadsheets file, only one spreadsheet's code is ever displayed.
I tried clicking all of the items in the Project window on the left side (those items related to the non-appearing code), but that didn't help.
Short of closing down one of the spreadsheets, is there any way to toggle between looking at the VBA code for two different, active spreadsheets?
Thanks!
You can either double click on the project explorer, or click in an element with the right button and choose "Display code". It should work.

Excel VBA Slow Opening

We have an excel workbook (xlsm) which has an embedded VBA code, which looks up the distance between two points using the getgoogledistance module.
Since we have added this to the workbook, it take a very long time to open sometimes in excess of 10 minutes..
I suspect on opening the workbook, it is trying to update all of the entries, hence why it is slow to open.
Is there a way in which I could add a button to the worksheet and rather than on 'open' update the necessary cells, when this button is clicked it updated all the cells?
Yes, you need to go to the options, then customize menu and from the list on the right, check the Developer menu.
Back to Excel, you'll be able to add controls such as push buttons and attach macros to them.

how to find what macro name has been assigned to an object in excel

I'm working on a spread sheet that someone else created and am having trouble in identifying which macros are assigned to the different objects. When I right click to :assign", it doesn't tell me what is already assigned. Is there a way to find out?
When you right click and select Assign Macro it should have the macro name already entered in the cell at the top, above the list of available macros. Alternatively clicking Edit should take you to the code. This works for Excel 2007 - you don't stipulate which you are using.
As a last resort, assuming you don't have masses and masses of macros, go to the VBE and put a break (click in the left margin to make it highlighted red) on the first line of each Sub/ Macro, then when you click the object it will take you to the VBE and highlight the line it stopped and thus the macro assigned.
If the objects the macro assigned to is grouped, excel doesn't show the macro assigned. Ungrouping objects will allow you to see which individual item actually has the macro assigned.

How to allow a Excel Sheet to stay active after initializing a combobox?

I wanted to know after I initialize a combobox, is there a possibility that I can still stay active with the background Excel sheet using the cursor like scroll the sheet up/down, type words on the sheet, etc?
(While at the same time the combobox still stays on top of the Excel sheet doing whatever event you might want to do with your VBA?)
Go to the VBA IDE and select your form. In the properties list (on the left hand side of the screen), find the ShowModal property. Set this to False.
This will prevent the dialog from taking over the window.

Resources