ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop trough comboboxes (https://www.excelbanter.com/excel-programming/377465-loop-trough-comboboxes.html)

Lasse

Loop trough comboboxes
 
Hi,
I have 10 comboboxes (named cbx1 to cbx10) in a worksheet. When I open the
workbook, is it possible to loop through the 10 comboboxes to set some data.

In Access it's possible with code like this:

For CB = 1 To 10
Me("cbx" & CB).Visible = True
Next CB

Is it possible to do something like that in Excel VBA?

//Lasse



[email protected]

Loop trough comboboxes
 
I believe the short answer to that is yes.

Regards,
Steve

Lasse wrote:

Hi,
I have 10 comboboxes (named cbx1 to cbx10) in a worksheet. When I open the
workbook, is it possible to loop through the 10 comboboxes to set some data.

In Access it's possible with code like this:

For CB = 1 To 10
Me("cbx" & CB).Visible = True
Next CB

Is it possible to do something like that in Excel VBA?

//Lasse



Chip Pearson

Loop trough comboboxes
 
Try something like

Dim Ctrl As MSForms.Control
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSForms.ComboBox Then
Ctrl.Visible = True
End If
Next Ctrl


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Lasse" wrote in message
...
Hi,
I have 10 comboboxes (named cbx1 to cbx10) in a worksheet. When I open the
workbook, is it possible to loop through the 10 comboboxes to set some
data.

In Access it's possible with code like this:

For CB = 1 To 10
Me("cbx" & CB).Visible = True
Next CB

Is it possible to do something like that in Excel VBA?

//Lasse






All times are GMT +1. The time now is 10:17 PM.

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