Thread: additional help
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 additional help

Dim cbox1 as msforms.combobox
dim cbox2 as msforms.combobox
With Worksheets("CCFCOK")
set cbox1 = .OleObjects("cmbcc").Object
set cbox2 = .OleObjects("cmbfc").Object
Set rng = .Range(.Cells(1, 1), .Cells(Rows.Count, _
1).End(xlUp))
Set rng = rng(cbox1.ListIndex + 1)
End With

cbox2.clear
Set cell = rng.Offset(0, 1)
Do While Not IsEmpty(cell)
If LCase(cell.Value) = "yes" Then
cbox2.AddItem cell.Parent.Cells(1, _
cell.Column).Value
End If
Set cell = cell.Offset(0, 2)
Loop

Make sure the combobox has an OleObject name of cmbfc for the 2ndbox and
cmbcc for the first box.

go into design mode and click on the combobox. Look in the name box.
Assumes both boxes are on sheet CCFCOK

--
Regards,
Tom Ogilvy


"scrabtree23" wrote in message
...
The two lines below are producing errors? I deleted the
first line and re-ran and the second line gave error?

With Worksheets("CCFCOK")
Set rng = .Range(.Cells(1, 1), .Cells(Rows.Count,
1).End(xlUp))
Set rng = rng(CCFCLC.cmbcc.ListIndex + 1)
End With

* CCFCLC.cmbfc.Clear
Set cell = rng.Offset(0, 1)
Do While Not IsEmpty(cell)
If LCase(cell.Value) = "yes" Then
* CCFCLC.cmbfc.AddItem cell.Parent.Cells(1,
cell.Column).Value
End If
Set cell = cell.Offset(0, 2)
Loop