A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

drop down list multiple columns



 
 
Thread Tools Display Modes
  #1  
Old January 26th, 2005, 04:03 PM
c
external usenet poster
 
Posts: n/a
Default drop down list multiple columns

Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c




  #2  
Old January 26th, 2005, 08:33 PM
Debra Dalgleish
external usenet poster
 
Posts: n/a
Default

There's a sample workbook on my web site that shows a product name and
code in the Data Validation dropdown list. After an item is selected,
the cell shows only the product name. You may be able to adapt this to
your workbook.

On the following page:

http://www.contextures.com/excelfiles.html

Under the data validation heading, find 'Data Validation "Columns"' and
download the file named DataValNameID.xls


c wrote:
Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #3  
Old January 26th, 2005, 09:09 PM
c
external usenet poster
 
Posts: n/a
Default

Debra,
Thansk again for your help. I guess I should have looked a little harder at
your website.

Sincerely
C

"Debra Dalgleish" wrote:

There's a sample workbook on my web site that shows a product name and
code in the Data Validation dropdown list. After an item is selected,
the cell shows only the product name. You may be able to adapt this to
your workbook.

On the following page:

http://www.contextures.com/excelfiles.html

Under the data validation heading, find 'Data Validation "Columns"' and
download the file named DataValNameID.xls


c wrote:
Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


  #4  
Old January 26th, 2005, 10:11 PM
c
external usenet poster
 
Posts: n/a
Default

I have run into one small problem with this code. It works excellent but
when I try to manually overwrite the contents in the cell I receive an error
message #1004. It indicates the problem is in:
Target.Value = Worksheets("Input").Range("J4") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Input").Range("BILLINGCATEGORIES"), 0),
0)

I have entered code which exits the function as soon as error 1004 occurs
but then it will no longer display one of the two values in the list. Both
values are now shown in the cell. Is there a way to "reset" this, I hope
this somewhat makes sense.

thanks again for any help you may have to offer.

c

"Debra Dalgleish" wrote:

There's a sample workbook on my web site that shows a product name and
code in the Data Validation dropdown list. After an item is selected,
the cell shows only the product name. You may be able to adapt this to
your workbook.

On the following page:

http://www.contextures.com/excelfiles.html

Under the data validation heading, find 'Data Validation "Columns"' and
download the file named DataValNameID.xls


c wrote:
Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


  #5  
Old January 26th, 2005, 11:00 PM
Debra Dalgleish
external usenet poster
 
Posts: n/a
Default

Make sure you run the line:

Application.EnableEvents = True

as part of the error handling


c wrote:
I have run into one small problem with this code. It works excellent but
when I try to manually overwrite the contents in the cell I receive an error
message #1004. It indicates the problem is in:
Target.Value = Worksheets("Input").Range("J4") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Input").Range("BILLINGCATEGORIES"), 0),
0)

I have entered code which exits the function as soon as error 1004 occurs
but then it will no longer display one of the two values in the list. Both
values are now shown in the cell. Is there a way to "reset" this, I hope
this somewhat makes sense.

thanks again for any help you may have to offer.

c

"Debra Dalgleish" wrote:


There's a sample workbook on my web site that shows a product name and
code in the Data Validation dropdown list. After an item is selected,
the cell shows only the product name. You may be able to adapt this to
your workbook.

On the following page:

http://www.contextures.com/excelfiles.html

Under the data validation heading, find 'Data Validation "Columns"' and
download the file named DataValNameID.xls


c wrote:

Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html





--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #6  
Old January 26th, 2005, 11:27 PM
c
external usenet poster
 
Posts: n/a
Default

Where exactly do I include this? I have tried it in a few locations and have
come up with nothing. I have the following:

On Error Goto Errhandler:

Code describing location of cell containing lists

Errhandler:
If Error.Number = 13 Then Exit Sub
If Error.Number = 1004 Then Exit Sub
Should it go here?

Code that changes cell value.

End sub

Thanks Again for any help.
c


"Debra Dalgleish" wrote:

Make sure you run the line:

Application.EnableEvents = True

as part of the error handling



  #7  
Old January 26th, 2005, 11:33 PM
c
external usenet poster
 
Posts: n/a
Default

Sorry,
Stupid question! It has been a long day.

Works perfect. I thank you again for all your help

Sincerely,
c

"Debra Dalgleish" wrote:

Make sure you run the line:

Application.EnableEvents = True

as part of the error handling


c wrote:
I have run into one small problem with this code. It works excellent but
when I try to manually overwrite the contents in the cell I receive an error
message #1004. It indicates the problem is in:
Target.Value = Worksheets("Input").Range("J4") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Input").Range("BILLINGCATEGORIES"), 0),
0)

I have entered code which exits the function as soon as error 1004 occurs
but then it will no longer display one of the two values in the list. Both
values are now shown in the cell. Is there a way to "reset" this, I hope
this somewhat makes sense.

thanks again for any help you may have to offer.

c

"Debra Dalgleish" wrote:


There's a sample workbook on my web site that shows a product name and
code in the Data Validation dropdown list. After an item is selected,
the cell shows only the product name. You may be able to adapt this to
your workbook.

On the following page:

http://www.contextures.com/excelfiles.html

Under the data validation heading, find 'Data Validation "Columns"' and
download the file named DataValNameID.xls


c wrote:

Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html





--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


  #8  
Old January 26th, 2005, 11:41 PM
Debra Dalgleish
external usenet poster
 
Posts: n/a
Default

In my code, I'd set it up like this:

'================================
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler

If Target.Cells.Count 1 Then GoTo exitHandler
If Target.Column = 2 Then
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Target.Value = Worksheets("Codes").Range("C1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)
End If

exitHandler:
Application.EnableEvents = True
Exit Sub

errHandler:
If Err.Number = 13 Or Err.Number = 1004 Then
GoTo exitHandler
Else
Resume Next
End If

End Sub
'=================================

c wrote:
Where exactly do I include this? I have tried it in a few locations and have
come up with nothing. I have the following:

On Error Goto Errhandler:

Code describing location of cell containing lists

Errhandler:
If Error.Number = 13 Then Exit Sub
If Error.Number = 1004 Then Exit Sub
Should it go here?

Code that changes cell value.

End sub

Thanks Again for any help.
c


"Debra Dalgleish" wrote:


Make sure you run the line:

Application.EnableEvents = True

as part of the error handling






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #9  
Old January 27th, 2005, 12:07 AM
Dave Peterson
external usenet poster
 
Posts: n/a
Default

That 1004 error can mean lots of things.

Before you spend lots of time...

Do you have a range named "billingCategories" on that "input" worksheet?
(spelling is very important--but upper/lower is not.)

Deb's code looks like:

Target.Value = Worksheets("Codes").Range("C1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)

You pointed at J4. Verify that this is ok, too.

(Prodlist pointed at B2:B4 in Deb's sample workbook. Is "billingcategories" set
up the same way?

c wrote:

I have run into one small problem with this code. It works excellent but
when I try to manually overwrite the contents in the cell I receive an error
message #1004. It indicates the problem is in:
Target.Value = Worksheets("Input").Range("J4") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Input").Range("BILLINGCATEGORIES"), 0),
0)

I have entered code which exits the function as soon as error 1004 occurs
but then it will no longer display one of the two values in the list. Both
values are now shown in the cell. Is there a way to "reset" this, I hope
this somewhat makes sense.

thanks again for any help you may have to offer.

c

"Debra Dalgleish" wrote:

There's a sample workbook on my web site that shows a product name and
code in the Data Validation dropdown list. After an item is selected,
the cell shows only the product name. You may be able to adapt this to
your workbook.

On the following page:

http://www.contextures.com/excelfiles.html

Under the data validation heading, find 'Data Validation "Columns"' and
download the file named DataValNameID.xls


c wrote:
Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



--

Dave Peterson
  #10  
Old January 27th, 2005, 03:13 PM
c
external usenet poster
 
Posts: n/a
Default

Thanks Dave,
I beleive all of the items you have pointed out are in order. I have made
the changes that Debra suggested and as of right now everything seems to be
working fine, even when I manually overwrite the contents of the list. I
still need to work with it a bit but I hope it is nearly a finished product.

Thanks for your help
c

"Dave Peterson" wrote:

That 1004 error can mean lots of things.

Before you spend lots of time...

Do you have a range named "billingCategories" on that "input" worksheet?
(spelling is very important--but upper/lower is not.)

Deb's code looks like:

Target.Value = Worksheets("Codes").Range("C1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)

You pointed at J4. Verify that this is ok, too.

(Prodlist pointed at B2:B4 in Deb's sample workbook. Is "billingcategories" set
up the same way?

c wrote:

I have run into one small problem with this code. It works excellent but
when I try to manually overwrite the contents in the cell I receive an error
message #1004. It indicates the problem is in:
Target.Value = Worksheets("Input").Range("J4") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Input").Range("BILLINGCATEGORIES"), 0),
0)

I have entered code which exits the function as soon as error 1004 occurs
but then it will no longer display one of the two values in the list. Both
values are now shown in the cell. Is there a way to "reset" this, I hope
this somewhat makes sense.

thanks again for any help you may have to offer.

c

"Debra Dalgleish" wrote:

There's a sample workbook on my web site that shows a product name and
code in the Data Validation dropdown list. After an item is selected,
the cell shows only the product name. You may be able to adapt this to
your workbook.

On the following page:

http://www.contextures.com/excelfiles.html

Under the data validation heading, find 'Data Validation "Columns"' and
download the file named DataValNameID.xls


c wrote:
Greetings;
I have a question I am hoping someone will be able to help me with. My
overall goal is to create a dropdown list with a line of data in it. When
selected only the second half of the line will be shown in the cell.

What I plan on doing is entering all of my data into two columns (first
column + second = dropdown list, second column = what is shown in the cell).
I would then create a drop down list from multiple columns. Using alot of IF
statements in VBA with a Private Sub Worksheet_Change(ByVal Target As Range)
program that would chage the entry from first column and second column to
only second column.

I have two questions-
1) Is it even possible to have a dropdown list based on two cells?

2) Is there an easier way than this? Since I have about 100 entries and
may want to add more later.

Thanks in advance for any comments or suggestions.
c






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



--

Dave Peterson

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
excel 97 vba - need to associate values with drop down list choice chief General Discussion 15 July 23rd, 2004 11:52 PM
Drop Down List / Count Function Mukiwa Worksheet Functions 2 July 7th, 2004 11:56 PM
synchronizing form and list box Deb Smith Using Forms 8 June 21st, 2004 08:15 PM
list pulldown selection returns multiple columns from a row - how? Peo Sjoblom Worksheet Functions 2 May 20th, 2004 04:15 PM


All times are GMT +1. The time now is 08:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.