ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting rowsource (https://www.excelbanter.com/excel-programming/360679-setting-rowsource.html)

Monique

setting rowsource
 
I have 5 combo boxes that must have the same rowsource

When I try to program this in VBA, the first one works but then after that I
receive the 424 Errror. I can't manually set it because the range changes, so
i have the code set up to get the last cell...

if anyone could help me that would be great....

Private Sub FillOrders(intLa As Integer)

cmbISBN1.RowSource = "Pinder!E2:E" & intLa
cmbISBN2.RowSource = "Pinder!E2:E" & intLa
cmbISBN3.RowSource = "Pinder!E2:E" & intLa
cmbISBN4.RowSource = "Pinder!E2:E" & intLa
cmbISBN5.RowSource = "Pinder!E2:E" & intLa

End Sub

Ivan Raiminius

setting rowsource
 
Hi Monique,

supposing that your comboboxes are on a userform and your sub is in
other module than in class module for the userform, you should try
this:

Private Sub FillOrders(intLa As Integer)
with userform1
..cmbISBN1.RowSource = "Pinder!E2:E" & intLa
..cmbISBN2.RowSource = "Pinder!E2:E" & intLa
..cmbISBN3.RowSource = "Pinder!E2:E" & intLa
..cmbISBN4.RowSource = "Pinder!E2:E" & intLa
..cmbISBN5.RowSource = "Pinder!E2:E" & intLa
end with
End Sub

change userform1 to appropriate name.

Did it help?

Regards,
Ivan



All times are GMT +1. The time now is 01:20 PM.

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