Excel - Popup Asking for Text w/ Drop Down - excel

Is it possible to have a macro that, when pressed, pops up a message box asking for a string of text, and then a drop down that has a list of categories?
All I would need it to do is take this information and save it into a cell. If so, how?

[I'm going based on Excel 2007 here, but if you're using 2003, you'll have to navigate the menu structure]
Go to the VBE (by going to the View tab, then click on Macro - creating or editing an existing one will take you there - or click Alt+F11).
Go to the Insert menu, and select Userform. Drag a textbox (the ab|icon), and a combobox onto your form. To set the textbox value to a cell when you change the combobox, create a subroutine in the code to do this by double clicking on the combobox.
Set the combobox items by using the .additem method of comboBox1 in your code. These can be delineated or grabbed from a range in your code (see here)
Within that subroutine, set the value of whatever cell you want to textbox1.Text, which is the contents of the textbox.

Related

Hide Excel ActiveX ComboBox DropDown list

I am aware that this thread already exists:
Hide DropDown list for ComboBox without losing focus
But unfortunately, it is for a UserForm and isn't applying to my questions.
My situation is rather on a Worksheet like below:
In fact, to show that dropdown list, here is what I did:
shLedgerImport.CboAcctCode.DropDown 'This function shows the dropdown list
But once it appears, I cannot hide it anymore:
---> I just want it to hide that dropdown list when I click on E2, of H5 or anywhere except E9 that is the ActiveCell.
(In case the user displayed it by mistake and want it to hide, what they need to do? Escape key isn't working, Click elsewhere isn't working)
Thank you

Check or Uncheck Checkbox based on Cell Value in Excel

I am trying to figure out if it is possible to check or uncheck a checkbox based on a value in a cell.
I have a userform that gets filled out and adds new lines on a worksheet with the relevant information gathered from the userform. I want to be able to search for a particular entry and fill out a neat created form on a excel worksheet (not a userform) using the gathered information. In this form I want to use checkboxes instead of cells to keep it neat and professional.
The reason I am doing this into a worksheet form instead of a userform is to be able to print the form into a PDF document. As far as I am aware it is not possible to print a userform into a PDF document.
If it is working the worksheet form should have checkboxes checked if TRUE is found in the cell from that particular data entry. I can't link a specific cell since it needs to find the correct cell based on the search entry.
Following on the comments... #Tom is correct, you can simply link the combobox to the cell in question.
Insert combobox:
Then simply enter the cell reference in the formula bar you want to link it to. Namely:

Uneditable combobox in Userform

I have made a userform using macros in excel.
The code is independent from excel (it does not read the data from excel).
Once the userform opens, I populate the combobox with few items in it by:
combo.additem "a"
combo.additem "b"
combo.additem "c"'
From what I found, in order to make the combobox uneditable, I need to change the style of the list to drop downlist.
However, once I have done so, my combobox options turns to be:
"" (blank cell)
a
b
c
Is there an option to keep the combobox uneditable without adding the first empty cell?
Thank you
The combobox will become an uneditable dropbox when you change its Style to 2 - fmStyleDropDownList.
Add .ListIndex=0 to your code to make the dropbox come up with no empty field and have the first item displayed as the default.

Preventing check boxes from being checked/unchecked

I have a workbook that has many checkboxes (form control) on one tab. I check the box (Yes/No/NA) based on values in other tabs,. The tab with the checkboxes, is a form that was created, that needs to be printed, but the users cannot click any of the boxes because these decisions are driven by formulas.
I have locked the workbook & unchecked all the boxes in the popup.
So the question is, how do I prevent all the check boxes from being clicked/checked??
AHIA,
LarryR...
For a Form Control:
Right-click and select Format Control...
Select the Protection tab.
Make sure that Locked is checked
Select the Control tab.
Choose a cell in the Cell Link field.
Press OK.
Right-click on the cell that you referenced in step 5.
Select Format Cells...
Select the Protection tab.
Make sure that Locked is checked.
Select Hidden if you don't want users to see it.
Press OK.
Right-Click on the Worksheet Tab
Select Protect Sheet
Make sure that Protect worksheet and contents of locked cells is checked.
That should do it!
Protect the cells with the check-boxes, and when you click on protect Sheet uncheck the Select locked cells from the list of what the users are allowed to do after the document is locked; that way they'll be able to see but not click on those cells.
Got the same issue and ive solved the issue by right click on the sheets and there is a grouping selection, ungroup it and the checkbox works again.

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