ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Global variables (https://www.excelbanter.com/excel-programming/377703-global-variables.html)

Ed

Global variables
 
How can I set up a global variable like:

Public lh as Integer

???

Gary''s Student

Global variables
 
Put it in a standard module before any subs for udf's
--
Gary's Student


"Ed" wrote:

How can I set up a global variable like:

Public lh as Integer

???


Bob Phillips

Global variables
 
In general, global variables are not necessary, and if possible are best
avoided. Why do you think you need one?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ed" wrote in message
...
How can I set up a global variable like:

Public lh as Integer

???




Chip Pearson

Global variables
 
Ed,

You do it exactly the way you have it below. Just be sure you have it in a
regular code module (in the VBA editor, Insert menu, Module). Don't put the
variable declaration in an object module (ThisWorkbook, the Sheets, a
UserForm, or a Class module).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email on the web site)

"Ed" wrote in message
...
How can I set up a global variable like:

Public lh as Integer

???




Ed

Global variables
 
Thanks for reply. I'll be using the calculated variable to be used in
a procedure that would will be run 55 times. Rather than calculate it
55 times, I calculate it as once as a public.



On Sun, 19 Nov 2006 17:14:47 -0000, "Bob Phillips"
wrote:

In general, global variables are not necessary, and if possible are best
avoided. Why do you think you need one?


Ed

Global variables
 
Thanks for a code module did the trick. thanks again.

Ed English



On Sun, 19 Nov 2006 11:42:13 -0600, "Chip Pearson"
wrote:

Ed,

You do it exactly the way you have it below. Just be sure you have it in a
regular code module (in the VBA editor, Insert menu, Module). Don't put the
variable declaration in an object module (ThisWorkbook, the Sheets, a
UserForm, or a Class module).


Ed

Global variables
 

Did that and solved the ptoblem. Thanks for replying.


Ed English



On Sun, 19 Nov 2006 08:51:02 -0800, Gary''s Student
wrote:

Put it in a standard module before any subs for udf's



All times are GMT +1. The time now is 07:02 AM.

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