Using variable in object name (VBA Excel) -


here want do:

private function foo(bar integer)     n = 0 combobox(bar).listcount - 1        [some stuff]     end end function 

i'm getting error on second line because i'm using (bar), rather (e.g.) 2, or 3.

can accomplish want do?

if on userform, can use:

for n = 0 me.controls("combobox" & bar).listcount - 1 

if worksheet module , activex combobox, need:

for n = 0 me.oleobjects("combobox" & bar).object.listcount - 1 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -