Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Way to use a variable from another macro


Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2012, 08:19 PM
srbball790 srbball790 is offline
Newcomer
 
Join Date: Jul 2012
Posts: 5
Default Way to use a variable from another macro


Does anyone know how to call a varaible in a macro from another macro?

Say the variable in one macro turns out to be some value x. I will want to use that same variable in another program, but I do not know how to do it.

Any help is appreciated. Thanks.
Reply With Quote
  #2  
Old 07-09-2012, 05:34 AM
Bob Phillips's Avatar
Bob Phillips Bob Phillips is offline
Contributor
 
Join Date: Jul 2009
Posts: 506
Default

Declare it as a Public variable.
Reply With Quote
  #3  
Old 07-10-2012, 12:27 AM
Owen Sparks Owen Sparks is offline
Newcomer
 
Join Date: Jan 2011
Posts: 1
Default

Quote:
Originally Posted by srbball790 View Post
Does anyone know how to call a varaible in a macro from another macro?

Say the variable in one macro turns out to be some value x. I will want to use that same variable in another program, but I do not know how to do it.

Any help is appreciated. Thanks.
Howdy. A little more information is required.

Where do you want to re-use this variable:-

(a) In another sub in the same module.
(b) In another module within the same workbook.
(c) In a seperate workbook.
(d) In a different program altogether.

O.S.
Reply With Quote
Reply

Tags
excel, macro, variable, vba


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->