Pass a cell value from one macro to another one

jbesclapez

Active Member
Joined
Feb 6, 2010
Messages
275
Hello Mr Excel,

I am trying to find some info on how to pass a cell value from one macro to another one.
The cell value of Range("A2") in Macro1 as to be used in a Macro2...

Obviously I googled and this but, I can not find anything simple like to understand.

If you can send me a macro with those example, I will then adapt it to my need.

Thanks for your help!
 
Thank all of you!
I manage to create a test example for a sub macro.
I am not sure I liked the way this works. Especially the fact that you must call the second macro within the first one. I though we could store it in a kind of RAM and reuse it later... but it does not seem the case.
So I finally reviewed my all macro to add a temp worksheet where I temporarly store those values.
Cheers
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Thank all of you!
I manage to create a test example for a sub macro.
I am not sure I liked the way this works. Especially the fact that you must call the second macro within the first one. I though we could store it in a kind of RAM and reuse it later... but it does not seem the case.
So I finally reviewed my all macro to add a temp worksheet where I temporarly store those values.
Cheers

Hi,
really sorry, thread got sidelined a little with a different issue.
Both posts answered your question to pass a value from one macro to another but if you want to HOLD the value in memory you can Declare your variable as Public. This would then be available to ALL your procedures in your project

Have a look here for further guidance:Declaring variables (VBA)

Many thanks for feedback - we appreciate it

Dave
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,974
Members
448,537
Latest member
Et_Cetera

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top