Forum Discussion
Eggselling
Dec 31, 2022Copper Contributor
Using Macros to add to a table
Keyboard Shortcut: Ctrl+y
'
Dim ws As Worksheet
Set ws = ActiveSheet
Table_Name = InputBox("Table2")
Dm tbl As ListObject
Set tbl = ws.ListObjects(Table_Name)
tbl.ListRows.Add
Range(Selecti...
JKPieterse
Jan 04, 2023Silver Contributor
Eggselling Post your code. Use the full text editor and use the "Insert code" button (right-most button) to insert your existing code.
- EggsellingJan 09, 2023Copper ContributorThanks Jan, just posted!
- macrordinaryNov 19, 2019Brass Contributor
JLSantiago Quick question with regard to your application - is there a need for a drop-down list, or is this something that could be accomplished using a slicer?
If you are filtering data in a table, then it would be a lot easier to manage using a slicer as opposed to using cell validation / dropdowns.
- JLSantiagoNov 19, 2019Copper Contributor
macrordinary My coworker has figured out how to accomplish this and will show me how he did it so I can apply this to other workbooks. Thank you
- mathetesNov 19, 2019Silver Contributor
JLSantiago Not knowing what your application is, I find myself wondering:
- How common is it that your users need more than one state? (my wife and I have residences in two states, so I can see how it could arise)...
- On those occasions when they DO (for whatever reason) need to enter two or more, would that kind of entry mess up sorting or filtering of the entire list for the sake of those few? (i.e., how do you use the entries in this field in your own analyses or services?)
- It occurs to me that, especially if it's relatively rare that this occasion arises, why not have the 51st answer on your drop down list "More than One State" and provide a comments field for use in that case?
- If it's more common, I think you'd be better served by headings like "Primary State" "Secondary State" or the like.
I offer these thoughts solely for the purpose of what we database designers call "data integrity," the idea of which is that you want entries in any given field, to be consistent: the answer to the question, or the single piece of info that fits. When we start making exceptions, it inevitably creates unanticipated problems at some point down the road. Obviously, this all depends on how you're using that item of info; if it's purely curiosity, that's less significant than if, say, tax tables depend on the answer.
- PReaganNov 19, 2019Bronze Contributor
Hello JLSantiago,
I discovered this solution after a short amount of time spent researching:
https://trumpexcel.com/select-multiple-items-drop-down-list-excel/
Additionally, you can create a Listbox by following this tutorial:
https://www.contextures.com/excel-data-validation-listbox.html