ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Two columns combined into one dropdownlist (https://www.excelbanter.com/excel-programming/391592-two-columns-combined-into-one-dropdownlist.html)

OTS[_2_]

Two columns combined into one dropdownlist
 
Hi.
I've got two columns containing data. A third coulmn can only contain data
from those two. What I need to do is, when adding validation to the third
column, add the data registerd in column 1 to the data in column 2 so that I
get a list to choose from in the dropdownlist in column 3.
Anyone got any idea on how to solve this?

Tom Ogilvy

Two columns combined into one dropdownlist
 
create a fourth location that has all the data and point your validation list
at this location.

--
Regards,
Tom Ogilvy


"OTS" wrote:

Hi.
I've got two columns containing data. A third coulmn can only contain data
from those two. What I need to do is, when adding validation to the third
column, add the data registerd in column 1 to the data in column 2 so that I
get a list to choose from in the dropdownlist in column 3.
Anyone got any idea on how to solve this?


OTS[_2_]

Two columns combined into one dropdownlist
 
Is there a way to do that when the two columns change their size. The two
lists will not be static, since they change when the user adds data.

"Tom Ogilvy" wrote:

create a fourth location that has all the data and point your validation list
at this location.

--
Regards,
Tom Ogilvy


"OTS" wrote:

Hi.
I've got two columns containing data. A third coulmn can only contain data
from those two. What I need to do is, when adding validation to the third
column, add the data registerd in column 1 to the data in column 2 so that I
get a list to choose from in the dropdownlist in column 3.
Anyone got any idea on how to solve this?


Tom Ogilvy

Two columns combined into one dropdownlist
 
Dim rng1 as Range, rng2 as Range, rng3 as Range
set rng1 = Range(Range("A1"),Range("A1").End(xldown))
set rng2 = Range(Range("B1"),Range("B1").End(xldown))
set rng3 = Range("IV1")
rng1.copy rng3
rng2.copy rng3.End(xldown)(2)
range(rng3,rng3.End(xldown)).Name = "List"

use List as the soure for your data validation.
Use the change event to update the data in IV2 (run the macro) whenever the
user makes a change in column A or B (adapt to your actual locations).

--
Regards,
Tom Ogilvy



"OTS" wrote:

Is there a way to do that when the two columns change their size. The two
lists will not be static, since they change when the user adds data.

"Tom Ogilvy" wrote:

create a fourth location that has all the data and point your validation list
at this location.

--
Regards,
Tom Ogilvy


"OTS" wrote:

Hi.
I've got two columns containing data. A third coulmn can only contain data
from those two. What I need to do is, when adding validation to the third
column, add the data registerd in column 1 to the data in column 2 so that I
get a list to choose from in the dropdownlist in column 3.
Anyone got any idea on how to solve this?


OTS[_2_]

Two columns combined into one dropdownlist
 
Great! Now I'm almost there I think. The only problem with this is that it
copies the cell and not the value of the cell. So I get the formula insted of
the value. This means that I do not get the desired result. What can I do to
just get the values instead?

"Tom Ogilvy" wrote:

Dim rng1 as Range, rng2 as Range, rng3 as Range
set rng1 = Range(Range("A1"),Range("A1").End(xldown))
set rng2 = Range(Range("B1"),Range("B1").End(xldown))
set rng3 = Range("IV1")
rng1.copy rng3
rng2.copy rng3.End(xldown)(2)
range(rng3,rng3.End(xldown)).Name = "List"

use List as the soure for your data validation.
Use the change event to update the data in IV2 (run the macro) whenever the
user makes a change in column A or B (adapt to your actual locations).

--
Regards,
Tom Ogilvy



"OTS" wrote:

Is there a way to do that when the two columns change their size. The two
lists will not be static, since they change when the user adds data.

"Tom Ogilvy" wrote:

create a fourth location that has all the data and point your validation list
at this location.

--
Regards,
Tom Ogilvy


"OTS" wrote:

Hi.
I've got two columns containing data. A third coulmn can only contain data
from those two. What I need to do is, when adding validation to the third
column, add the data registerd in column 1 to the data in column 2 so that I
get a list to choose from in the dropdownlist in column 3.
Anyone got any idea on how to solve this?



All times are GMT +1. The time now is 06:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com