View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default intersect and combo box

Dim rng as Range, cell as Range

set rng = Range(combobox1.Rowsource)
set rng = rng(combobox1.listindex + 1)

or
With Worksheets("Coding")
Set rng = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
set rng = rng(combobox1.ListIndex + 1)
End with

then
combobox2.Clear
set cell = rng.offset(0,1)
do while not isempty( cell)
if Lcase(cell.value) = "yes" then
Combobox2.AddItem cell.parent.Cells(1,cell.Column).Value
end if
set cell = cell.offset(0,2)
Loop

--
Regards,
Tom Ogilvy


"scrabtree" wrote in message
...
I have a sheet ("Coding"). It has Cost Center numerical
codes running down column A, and Function Code numerical
codes running across row 1. In the intersecting cell
either the words yes or no appears. "Yes" if this is an
appropriate combination or "No" if it is not.

A userform is initiated and the employee selects a Cost
Center Code from a drop down Combo box. I need a code
that will then find that numeric code in the sheet "Coding
A:A" and will then populate Function Code Combo box
selections with only the Function Codes that can be
appropriately used. The code needs to look across the
cooesponding row and then insert the approriate Column
header for any cell that is labeled "Yes" for that Cost
Center.