PDA

View Full Version : [SOLVED:] need Code to select value from dropdown list using numeric values



gamini
09-27-2022, 08:21 PM
Please send me code to the following example:
There is a column with dropdown list to select values e.g. A1 to A10 have dropdown lists with values "aaaaaa","bbbbb","cccccc","dddddd","eeeee"
There are numeric values from B1 to B10. between 0 to 4
The code or function must read values from column B and select values in Column A accordingly.
If B2 has 2, the value of A2 should be "cccccc" or If B3 has 0, the value of A2 should be "aaaaaa"
Thank You in Advance

Gamini

arnelgp
09-27-2022, 09:22 PM
you may try this.

gamini
09-27-2022, 11:03 PM
Thank you, a great job. There is a simple change. Can you please change the function to accept 5 parameters
parameter 1 = Sheet2
parameter 2 = Sheet1
p3 = sheet 2 column
p4 = sheet 1 column
p5= number of cells


The function read numeric values from par 1 and change combo boxes in sheet 1
This is because I have around 1000 combo boxes in one sheet. So this could be a great help.
See attached file

Aussiebear
09-28-2022, 12:48 PM
There is a simple change. Can you please change the function to accept 5 parameters
parameter 1 = Sheet2
parameter 2 = Sheet1
p3 = sheet 2 column
p4 = sheet 1 column
p5= number of cells

This is not a "simple change" from your description.

Parameter 1 = Sheet2. What on sheet 2 are we looking at? Your supplied file simply had a range of cells ( 0-5) in column A. Is this how your data is laid out?

Parameter 2 = Sheet1. You indicated in post #3, that Sheet 1 has 1000 combo boxes but you have uploaded the file created by arnelgp as your example. That doesn't help us at all.

Parameters 3 & 4, you reference a sheet number but not a column. Are we to guess the column number?


The function read numeric values from par 1 and change combo boxes in sheet 1
Have you changed your mind here? Arnelgp has supplied you already with a good answer to this issue


This is because I have around 1000 combo boxes in one sheet. So this could be a great help.
See attached file

Your attached file does not reflect any of this. If you want our help ( and Im sure there are people here who would like to do so), you need to reconsider how you are going about this. Firstly, attach a real file, as in how you have your workbook set out. No, we don't need 1000 comboboxes on sheet1, and no, we don't need your actual data, just something that accurately reflects the type of data.

gamini
09-28-2022, 07:47 PM
Attached excel file has the real data. In sheet Ranking template has the same combobox in 301*22 cells. In sheet Input you have the numeric values. The function need to read the numeric values in the column"" and select the combobox value in sheet Ranking template accordingly.
e.g. in sheet Input the person "Hon. Aravindh Kumar" has 1 in cell A2 then in sheet Ranking template "Hon. Aravindh Kumar" gets the value "High" (2nd value of the list).

I have such around 120 such work-books.
Sorry if I could't explain in earlier queries.

Thank you all for helping
Gamini

arnelgp
09-29-2022, 07:07 AM
try to input some numbers on "Input" sheet.

gamini
09-29-2022, 09:17 PM
As requested I have included more input. Please see attached file sample12.xlsm. Thank you for the patience and trying to help me.
If You need more I will gladly do that.

arnelgp
09-29-2022, 11:12 PM
i added a "Button" on Input sheet for "force" update Ranking Template sheet.

gamini
09-30-2022, 12:49 AM
I did a test by adding values to col B toE
colB all 0
colC all 2
colD all 3
colE all 1
Please check new file entries01.xlsm

I clicked the button "Update Ranking Template Worksheet"

But the values in "Ranking Template" didn't change.
Did I do something wrong?

arnelgp
09-30-2022, 02:20 AM
what is the value of "very high", "Excellent", and "strongly agree"? is it 0?
the vba uses 0 for the above ratings.

also did you "enable" these warning messages?
30188

and this message:

30189

you should "Enable" all macro on your workbook.

gamini
09-30-2022, 03:31 AM
I changed the master Data
5 Very High
4 High
3 Average
2 Low
1 Very Low
0 Unknown



Now for the Row "Hon. Aravindh Kumar" the macro changed all the columns to "Unknown" after clicking the button, but there are no changes to other fields
Please see Entries02.xlsm. There were no warnings. Macros work fine.
Sorry for troubling you..

arnelgp
09-30-2022, 04:18 AM
i import it to sample12.xlsm

gamini
09-30-2022, 04:46 AM
Working fine, Thank you so much. Really appreciate it.

arnelgp
09-30-2022, 05:26 AM
:hi: