ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   additional help (https://www.excelbanter.com/excel-programming/310056-additional-help.html)

scrabtree23[_2_]

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

Tom Ogilvy

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





All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com