excel - How to use data entered into userform in main module -
i new coding vba. have userform 5 textboxes. user enter integer in first textbox , cell locations (e.g. a1) in last 4 textboxes. want these data used in main module. need use integer in loop, i.e. loop until counter reaches integer. need use cell locations begin accessing different datasets, anywhere within sheet.
i having trouble accessing these data in main module. hide form when user clicks ok button. test code writing data textboxes cells.
the code main module:
sub sort2stack() userinput.show cells(5, 22).value = testperiod.value 'integer entered in textbox 1 cells(6, 22).value = ymloc.value 'cell location entered in textbox 2 cells(7, 22).value = yfloc.value ' . cells(8, 22).value = nmloc.value ' . cells(9, 22).value = nfloc.value 'cell location entered in textbox 5 end sub
i runtime error 424, object required. pretty , have searched while--new this.
please advise. thank in advance!
cells(5, 22).value = userinput.testperiod.text
i think need refer userform @ values. that's assuming did hide form , not unload it. @ end of procedure, before end sub, should
unload userinput
to form out of memory.
Comments
Post a Comment