ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reference to a different Sub (https://www.excelbanter.com/excel-programming/357618-re-reference-different-sub.html)

Jim Thomlinson

Reference to a different Sub
 
So in button 1 you get some data from the user. Where do you store that data?
Bare in mind that the variables you declare in a sub last only as long as
that sub is running. Whe th ebub ends the data in the varaible is lost. If
you want to use that data later you need to store it somewhere other than the
sub, such as in a global variable declared at the top of the code module, or
directly in a cell in the spreadsheet.
--
HTH...

Jim Thomlinson


"pontiy" wrote:


Id appreciate you answering this question for me.


I have prompted the user for an input in one of my subs:
Private Sub CommandButton1_Click()

And now I need to use this data in a different sub:
Private Sub CommandButton5_Click()

How do I reference to a different sub to get my value?

Thank you.


--
pontiy
------------------------------------------------------------------------
pontiy's Profile: http://www.excelforum.com/member.php...o&userid=32885
View this thread: http://www.excelforum.com/showthread...hreadid=528325




All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com