arrays - Userform Combo List from Sheet Names -
i have sub call open workbook in window (using getopenfilename , workbooks.open) , copy entire sheet contents 1 file , paste new sheet in macro workbook (active workbook), close second workbook without saving.
i want implement userform combobox populated sheets second workbook (whose name stored string "vfile".
i'm assuming i'll need userform_initialize
, me.combobox1.list = activeworkbook.sheetnames
???
thanks in advance.
sorry figuring out not long after posting, i'll provide answer found in case others need it, or maybe better answer suggested:
private sub userform_initialize() dim snarray variant redim snarray(1 sheets.count) = 1 sheets.count snarray(i) = activeworkbook.sheets(i).name debug.print snarray(i) next me.combobox1.clear me.combobox1.list = snarray end sub
and it's simple as:
private sub commandbutton1_click() if combobox1.value = "" msgbox ("please select sheet import.") else worksheetvalue = combobox1.value 'global string dimension call later end if unload me end sub
Comments
Post a Comment