Hi there,
I an try to get the value from a drop down box and place in it a cell.
Does anyone know the code to do this .
Please I am new to this and any help would be great.
Thanks
What kind of "drop down" box are you using?
Data validation - drop down?
Forms Combo box?
Combo box from the Controls Tool Box?
The answer depends on the type of "drop down".
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
The exact code would depend on the name of your combobox and which cell you want to add the value to. Assuming the combobox is name JamCombo and you want it in cell A1, the code would be:
It depends on if the combobox is on the active worksheet, another worksheet, or a userform.Code:Cells(1,"A").Value = JamCombo.Value
If you gave more details or posted a sample worksheet it would be easier to provide you the info you are looking for.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
Or to save time with re-naming or matching the names of combo boxes and avoiding debug errors...as Palmetto suggested...you can use data validation.
To do this
- Click the cell where you want the drop down box to be
- Click Data, Validation
- In the "Allow" drop-down box, select "List"
- In the source box Type your options e.g A,B,C,D,E,Etc - make sure to seperate with a comma.
- Click Ok
Then finally where you want the cell to automatically link to it (this will display whatever option you have selected from the drop-down, click in that cell and type = and then click the cell where you drop-down (data validation box) is.
Ex.
Data Validation (drop-down box) is A1
You want the cell match to be D1.....in D1 type =A1...this will then automatically change as to whatever has been selected in cell A1.
Please see attached example.
HTH
Last edited by thompsy121; 03-19-2010 at 04:17 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks