Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
BB
 
Posts: n/a
Default combo box named range

First of all, I wanna let all you guys know you are great and have taught me
a lot of excel in little over a week here.

So I have a little brain teaser.

I am making a spreadsheet with three drop down lists, the last two dependent
on succession. From the first, you pick either the word "foreign" or
"domestic." That is followed in the next column by a list that will let you
pick either a US State or a national country, depending on your first
selection. The last column is a city column that will let you pick a city in
one of the state/countries. To make scrolling easier, I looked up your advice
on combo boxes and played around in VBA until I finally got it working...
almost.

For all of the certain states or countries which have two words in the name
(New Hampshire, Saudi Arabia, etc.) the combo box for the following (city)
drop down comes up blank when i double-click, but the original data
validation list still drops down the names. Essentially, I can't use the
combo box to pick a city from any state/country with two names, but I know
the formula is still there because I can select it from the validation
drop-down.

Here is the part of VBA which I think pertains to this- and I am not sure
because I have never done anything in VBA:

If Target.Validation.Type = 3 Then
Application.EnableEvents = False
If Target.Column = 3 Then
str = Target.Validation.Formula1
Else
str = "=" & Target.Offset(0, -1).Value
End If
str = Right(str, Len(str) - 1)
With cboTemp
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 15
.Height = Target.Height + 5
.ListFillRange = str
.LinkedCell = Target.Address
End With
cboTemp.Activate


--Column three is the very first one (foreign/domestic).
I got the VBA straight off of the excel example for dependent combo box
validation lists on contextures.com (GREAT website by the way, thank you for
making it easy for those of us less capable) and made a couple of necessary
adjustments to make it fit mine.

Sorry for making you read all this, and thanks in advance if you did.
  #2   Report Post  
PegL
 
Posts: n/a
Default

Have a look at http://www.contextures.com/xlDataVal02.html#TwoWord

"BB" wrote:

First of all, I wanna let all you guys know you are great and have taught me
a lot of excel in little over a week here.

So I have a little brain teaser.

I am making a spreadsheet with three drop down lists, the last two dependent
on succession. From the first, you pick either the word "foreign" or
"domestic." That is followed in the next column by a list that will let you
pick either a US State or a national country, depending on your first
selection. The last column is a city column that will let you pick a city in
one of the state/countries. To make scrolling easier, I looked up your advice
on combo boxes and played around in VBA until I finally got it working...
almost.

For all of the certain states or countries which have two words in the name
(New Hampshire, Saudi Arabia, etc.) the combo box for the following (city)
drop down comes up blank when i double-click, but the original data
validation list still drops down the names. Essentially, I can't use the
combo box to pick a city from any state/country with two names, but I know
the formula is still there because I can select it from the validation
drop-down.

Here is the part of VBA which I think pertains to this- and I am not sure
because I have never done anything in VBA:

If Target.Validation.Type = 3 Then
Application.EnableEvents = False
If Target.Column = 3 Then
str = Target.Validation.Formula1
Else
str = "=" & Target.Offset(0, -1).Value
End If
str = Right(str, Len(str) - 1)
With cboTemp
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 15
.Height = Target.Height + 5
.ListFillRange = str
.LinkedCell = Target.Address
End With
cboTemp.Activate


--Column three is the very first one (foreign/domestic).
I got the VBA straight off of the excel example for dependent combo box
validation lists on contextures.com (GREAT website by the way, thank you for
making it easy for those of us less capable) and made a couple of necessary
adjustments to make it fit mine.

Sorry for making you read all this, and thanks in advance if you did.

  #3   Report Post  
BB
 
Posts: n/a
Default

Thanks for the speedy reply.

I originally did get my formula from that website. My current formula in the
cell validation is =INDIRECT(SUBSTITUTE(D5," ","")).

The validation list picks this up fine, and the cities show up. But the
combo box does not pick up the formula. Do I need something more complicated?

"PegL" wrote:

Have a look at http://www.contextures.com/xlDataVal02.html#TwoWord

"BB" wrote:

First of all, I wanna let all you guys know you are great and have taught me
a lot of excel in little over a week here.

So I have a little brain teaser.

I am making a spreadsheet with three drop down lists, the last two dependent
on succession. From the first, you pick either the word "foreign" or
"domestic." That is followed in the next column by a list that will let you
pick either a US State or a national country, depending on your first
selection. The last column is a city column that will let you pick a city in
one of the state/countries. To make scrolling easier, I looked up your advice
on combo boxes and played around in VBA until I finally got it working...
almost.

For all of the certain states or countries which have two words in the name
(New Hampshire, Saudi Arabia, etc.) the combo box for the following (city)
drop down comes up blank when i double-click, but the original data
validation list still drops down the names. Essentially, I can't use the
combo box to pick a city from any state/country with two names, but I know
the formula is still there because I can select it from the validation
drop-down.

Here is the part of VBA which I think pertains to this- and I am not sure
because I have never done anything in VBA:

If Target.Validation.Type = 3 Then
Application.EnableEvents = False
If Target.Column = 3 Then
str = Target.Validation.Formula1
Else
str = "=" & Target.Offset(0, -1).Value
End If
str = Right(str, Len(str) - 1)
With cboTemp
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 15
.Height = Target.Height + 5
.ListFillRange = str
.LinkedCell = Target.Address
End With
cboTemp.Activate


--Column three is the very first one (foreign/domestic).
I got the VBA straight off of the excel example for dependent combo box
validation lists on contextures.com (GREAT website by the way, thank you for
making it easy for those of us less capable) and made a couple of necessary
adjustments to make it fit mine.

Sorry for making you read all this, and thanks in advance if you did.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLookup with concatinated named range David Gibson Excel Worksheet Functions 1 May 26th 05 02:04 PM
Identifying single column within named range ESAEO Excel Discussion (Misc queries) 2 March 24th 05 09:30 PM
Define a range based on another named range Basil Excel Worksheet Functions 2 February 21st 05 01:47 PM
How do you point to a named range in linked workbooks? KG Excel Discussion (Misc queries) 5 February 18th 05 09:55 PM
named range refers to: in a chart Spencer Hutton Excel Discussion (Misc queries) 1 December 14th 04 10:15 PM


All times are GMT +1. The time now is 01:30 AM.

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

About Us

"It's about Microsoft Excel"