excel - transferring variable form one workbook to another woorkbook vba -
i still newbies in vba programming
i have simple questions looking simple methode if possible.
i creating userform( userform1) in workbooka , in userform, i'll needing module(module1) created in other workbook( workbookb) made calculation. in order launch calculation, module need info( ttaa, tolerance). love know easiest way transfer variable userform1(workbooka.userform1) module1(workbookb.module1) , re-transfer results userform1.
below, can find small part of programm i've coded call module.
ttaa = cdbl(me.ttaa_textbox.value) tolerance = cdbl(me.tolerance_textbox.value) application.run ("'workbooks.xls'!module1")
i've declared public, variable ttaa
, tolerance
in module1
really appreciated help. in advance
the easiest way (which know work) temporarily "save" variable on sheet in 1 of either file , reference as
worksheets.add.name = "tmp" workbooks(workbooka.name).worksheets("tmp").range("a1").value2 'and remove later on application.displayalerts = false workbooks(workbooka.name).worksheets("tmp").delete application.displayalerts = true
an alternative might declare subs
in workbookb functions. apart public
variables way return values (in native format) independent vba code segments. yet, if had no luck public
variables doubt work.
but why don't import module workbooka instead? following answer might able that. writing macro writes macro excel-file
Comments
Post a Comment