HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE
DEAR ALL
What I need is asf: In worksheet procedure (procedure resides in microsoft excel objects) using a command button click one result is obtained say total cargo figures and the variable name is - cgofigs-. I want this variable -cgofigs- to be taken to standard module to carryout other calculations using this variable -cgofigs- result. Pls advice how to call this -cgofigs- variable from excel sheets procedure into the modules? |
HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE
One way to do it is to assign the value to a named range, which will
maintain the value even when other routines have ended (and hence would not be able to carry the value on to other routines). Add this line to the code that determines the value: Names("nrCgoFigs").Value = cgofigs Other routines can then refer to Names("nrCgoFigs").Value. Dave O |
HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE
On Feb 2, 11:33 pm, "Dave O" wrote:
One way to do it is to assign the value to a named range, which will maintain the value even when other routines have ended (and hence would not be able to carry the value on to other routines). Add this line to the code that determines the value: Names("nrCgoFigs").Value = cgofigs Other routines can then refer to Names("nrCgoFigs").Value. Dave O D/DAVE Thnks fr quick response. At present I am doing like that -- assigning it to one of the cells and calling it. But for knowledge sake i want to know how to do it thro calling that variable from excell sheet procedure into module procedure. Pls adv |
HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE
Routines can pass public variables back and forth but only when all
the routines in question are running. That's why the named range technique works- because the value persists in memory even when the routine that generates it has ended. If the value of cgofigs is written to a cell or is the result of a formula in a cell, a routine can refer to the value of that cell: Range("'sheet1'!b2").Value |
HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE
On Feb 3, 12:07 am, "Dave O" wrote:
Routines can pass public variables back and forth but only when all the routines in question are running. That's why the named range technique works- because the value persists in memory even when the routine that generates it has ended. If the value of cgofigs is written to a cell or is the result of a formula in a cell, a routine can refer to the value of that cell: Range("'sheet1'!b2").Value D/DAVE Thank you and I got better solution than i asked for. I tried your sugestion and it is great. I did it the way u sugested but confirm my steps right or not. In the activesheet i assigened a cell and given it the name nrCgoFigs. And in the code i hv added what u sugested. Names("nrCgoFigs").Value = cgofigs . |
HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE
Glad to help!
|
All times are GMT +1. The time now is 12:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com