ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Access a Variable from the Worksheet (https://www.excelbanter.com/excel-programming/415658-access-variable-worksheet.html)

Gary''s Student

Access a Variable from the Worksheet
 
Is there anyway to link the value of a public variable in a module to a Name
in the worksheet?

For example:

Public mesge As String
Sub anything()
mesge = "Hello World"
End Sub

and then somehow define a Name of the worksheet so that:
=mesge
would display:
Hello World
--
Gary''s Student - gsnu200800

Bob Phillips[_3_]

Access a Variable from the Worksheet
 
Activeworkbook.Names.Add Name:="msge", RefersTo:="Hello World"

--
__________________________________
HTH

Bob

"Gary''s Student" wrote in message
...
Is there anyway to link the value of a public variable in a module to a
Name
in the worksheet?

For example:

Public mesge As String
Sub anything()
mesge = "Hello World"
End Sub

and then somehow define a Name of the worksheet so that:
=mesge
would display:
Hello World
--
Gary''s Student - gsnu200800




Gary''s Student

Access a Variable from the Worksheet
 
PERFECT!
--
Gary''s Student - gsnu200800


"Bob Phillips" wrote:

Activeworkbook.Names.Add Name:="msge", RefersTo:="Hello World"

--
__________________________________
HTH

Bob

"Gary''s Student" wrote in message
...
Is there anyway to link the value of a public variable in a module to a
Name
in the worksheet?

For example:

Public mesge As String
Sub anything()
mesge = "Hello World"
End Sub

and then somehow define a Name of the worksheet so that:
=mesge
would display:
Hello World
--
Gary''s Student - gsnu200800






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

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