ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combo box + option all + use all functions when this is pressed (https://www.excelbanter.com/excel-programming/372590-combo-box-option-all-use-all-functions-when-pressed.html)

Monte0682

combo box + option all + use all functions when this is pressed
 
I have a combo box that contains: 1, 2, 3, and all. These represent
different situations. So for situation 1, it should do function 1. For
all I want to be able to do all 3 functions.

ok. Now I have a functions that are called: function 1, function 2,
function 3 and function all

if I say:

if combo_box.value=all then
for i=1 to 3
controls("function "& i
next i
end if

See what I mean... how can I use functions in a for loop and just
assign the index....


NickHK

combo box + option all + use all functions when this is pressed
 
Function names are not held as strings :
e.g. Call MyFunction1(args)
Or RetVal=MyFunction1()
so you cannot build the name with a variable like that.

But maybe you can use Application.Run "MyFunction" & i instead.
The functions need to be in a module for this to work.

NickHK

"Monte0682" wrote in message
ups.com...
I have a combo box that contains: 1, 2, 3, and all. These represent
different situations. So for situation 1, it should do function 1. For
all I want to be able to do all 3 functions.

ok. Now I have a functions that are called: function 1, function 2,
function 3 and function all

if I say:

if combo_box.value=all then
for i=1 to 3
controls("function "& i
next i
end if

See what I mean... how can I use functions in a for loop and just
assign the index....





All times are GMT +1. The time now is 11:12 PM.

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