Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating a combo box from a Validation


I have a list of Territorial managers id's that are listed using simple
data validation. But when they pick their number from the validated
cell I need a combo box populated with only the customers that
territory manager has. I have data with over 2000 customers linked to
about 60 different TM#'s to select from so the cell needs to populate
and update automatically when new data is entered into the data sheet.
The data is on the "Data" sheet and the workbook is on sheet "Day".

This data need to fill 25 combo boxes (all with the same information,
even duplicates in each combo box) each in a different row. (We are
keeping a record of the Territorial manager's traveling for each
customer they meet with in a single month). The max amount of customers
they can visit is no more than 25, so if they actually met with 25
customers each customer is known.

I have a formula for variable strings that i posted earlier today, but
I found out that simple data validation in the excel cell can't handle
the excessive amount of data, and I receive 1004 runtime errors and
then sometimes it won't populate all the data into the cell, and cutoff
letters of customer's names.

Any solutions are welcomed, I am at the point where I am going to be
working on this project forever. thanks for any help

Jason


--
jasda2
------------------------------------------------------------------------
jasda2's Profile: http://www.excelforum.com/member.php...o&userid=23956
View this thread: http://www.excelforum.com/showthread...hreadid=375804

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Populating a combo box from a Validation

loop through you data and load an array with the information you need in the
combobox for each row that meets the TM#.

Assign the array to the list of each combobox.

Dim v as Variant
Dim i as Long

With worksheets("Data")
set rng = .Range(.Cells(2,"C"),.Cells(2,"C").end(xldown))
End with
redim v(1 to rng.count)
i = 0
for each cell in rng
if cell.value = Worksheets("Day").Range("A1") then
i = i + 1
v(i) = cell.offset(0,-2).Value
end if
Next
redim preserve v(1 to i)
for each oleObj on worksheets("Day").OleObjects
if typeof oleObj.Object is MSforms.combobox then
oleObj.Object.List = v
end if
Next

--
Regards,
Tom Ogilvy

"jasda2" wrote in
message ...

I have a list of Territorial managers id's that are listed using simple
data validation. But when they pick their number from the validated
cell I need a combo box populated with only the customers that
territory manager has. I have data with over 2000 customers linked to
about 60 different TM#'s to select from so the cell needs to populate
and update automatically when new data is entered into the data sheet.
The data is on the "Data" sheet and the workbook is on sheet "Day".

This data need to fill 25 combo boxes (all with the same information,
even duplicates in each combo box) each in a different row. (We are
keeping a record of the Territorial manager's traveling for each
customer they meet with in a single month). The max amount of customers
they can visit is no more than 25, so if they actually met with 25
customers each customer is known.

I have a formula for variable strings that i posted earlier today, but
I found out that simple data validation in the excel cell can't handle
the excessive amount of data, and I receive 1004 runtime errors and
then sometimes it won't populate all the data into the cell, and cutoff
letters of customer's names.

Any solutions are welcomed, I am at the point where I am going to be
working on this project forever. thanks for any help

Jason


--
jasda2
------------------------------------------------------------------------
jasda2's Profile:

http://www.excelforum.com/member.php...o&userid=23956
View this thread: http://www.excelforum.com/showthread...hreadid=375804



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating a combo box from a Validation


Can someone elaborate on to create a variable array based off m
conditions. The array neems to be built so when i select the TM nam
range (ie 0511,3111,2111, etc #) that the customers in the coordinat
with the Tm#.

Column 1 (TM#) Column 2 (customer name)
0511 dfsfgdffg
0511 sdafgdfg
0511 sddsfsda
0511 ssdafsdaf
0511 dsfsadf
0511 sdfsadfsdf
3111 dsfdsfsdf
3111 sdffdssdaf
3111 dsfsdfafds
3111 sadfsdadfs
3111 fdsfdsfds
2111 dfsfdsfds
2111 dfsfdsdfs
2111 sadffsadfds


Only thing I need is an array built like so...

0511
sadfdsfa
fdfgfdfgfddf
fdsag
sdfsdsadfgbadf
sdafdfsdasdsdfsd

then i can name the variable array/range so I can map it to anothe
drop down menu (validation or combo box, whichever is easier)..

--
jasda
-----------------------------------------------------------------------
jasda2's Profile: http://www.excelforum.com/member.php...fo&userid=2395
View this thread: http://www.excelforum.com/showthread.php?threadid=37580

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Populating a combo box from a Validation

Dim sTarget as String
Dim rng as Range, rng2 as Range
Dim rngStart as Range, rngEnd as Range
Dim cell as Range
sTarget = "0511"
With Worksheets("Data")
set rng = .Range(.cells(2,2),.cells(2,2).End(xldown)(2))
End With
set rngStart = nothing
for each cell in rng
if cell.Offset(0,-1).Text = sTarget then
if rngStart is nothing then
set rngStart = cell
end if
Elseif cell.offset(0,-1).Text < sTarget and _
not rngStart is nothing then
set rngEnd = cell.offset(-1,0)
exit for
end if
Next cell
set rng2 = Range(rngStart,rngEnd)
rng2.Name = "List1"
msgbox rng2.Address

--
Regards,
Tom Ogilvy


"jasda2" wrote in
message ...

Can someone elaborate on to create a variable array based off my
conditions. The array neems to be built so when i select the TM name
range (ie 0511,3111,2111, etc #) that the customers in the coordinate
with the Tm#.

Column 1 (TM#) Column 2 (customer name)
0511 dfsfgdffg
0511 sdafgdfg
0511 sddsfsda
0511 ssdafsdaf
0511 dsfsadf
0511 sdfsadfsdf
3111 dsfdsfsdf
3111 sdffdssdaf
3111 dsfsdfafds
3111 sadfsdadfs
3111 fdsfdsfds
2111 dfsfdsfds
2111 dfsfdsdfs
2111 sadffsadfds


Only thing I need is an array built like so...

0511
sadfdsfa
fdfgfdfgfddf
fdsag
sdfsdsadfgbadf
sdafdfsdasdsdfsd

then i can name the variable array/range so I can map it to another
drop down menu (validation or combo box, whichever is easier)...


--
jasda2
------------------------------------------------------------------------
jasda2's Profile:

http://www.excelforum.com/member.php...o&userid=23956
View this thread: http://www.excelforum.com/showthread...hreadid=375804



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating a combo box from a Validation


Tom I thank you for the replies, but I cannot seem to get any of th
code working. The TM# is the variable number that is pulled down fro
a validated list I have. This variable number is the number that need
to match whatever is the corresponding customer. So if 1157 has 5
customers, thos 50 customers listed will populate a field/array/lis
something that i can work with, but it needs to be variable. So i
1157# changes to 0511 then the list changes and fills with that number
corresponding customers. If the comboxbox is avoidable thats better, i
not it will be fine. But all the code you posted I'm lost what goe
where, and where I need to change it to fit my needs.

The numbers and customers are listed in ascending order with customer
matching. i.e.

1157 sadsda
1157 fgfgvfv
1157 dsdsdc
1157 xzdsffv
0511 vbdfdf
0511 sddsffsd
0511 ujujyujy

These are also on a different worksheet. The variable TM# is cel
$B$4. This is the number that changes.

Jaso

--
jasda
-----------------------------------------------------------------------
jasda2's Profile: http://www.excelforum.com/member.php...fo&userid=2395
View this thread: http://www.excelforum.com/showthread.php?threadid=37580



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
Populating a Combo Box Bryan Excel Programming 1 February 25th 05 06:50 PM
Populating the combo from worksheets Siva Excel Programming 1 February 1st 05 10:48 AM
Populating combo boxes Cecilkumara Fernando Excel Programming 3 November 7th 03 02:38 AM
Populating combo box with a function Derek Gadd Excel Programming 5 October 29th 03 10:59 AM
Populating Combo Boxes Tom Ogilvy Excel Programming 0 September 25th 03 04:29 AM


All times are GMT +1. The time now is 03:31 PM.

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

About Us

"It's about Microsoft Excel"