Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help me refer to a fixed value.


Hi

I have a value in workbook which I would like to use a lot of times
without typing in DIM Var as string then Var =
Sheets("Sheet1").range("A1").value in every single sub that I have.

How could I refer to this figure and save time/ my fingers from typing
exactly the same process?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=553325

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Please help me refer to a fixed value.

if you Dim the variable at the top of the module (in the General section) it
will be visible to all sub/functions in that module, and if you declare it
"Public" it will be visible in the subs of the sheets/workbook, etc.

"funkymonkUK" wrote:


Hi

I have a value in workbook which I would like to use a lot of times
without typing in DIM Var as string then Var =
Sheets("Sheet1").range("A1").value in every single sub that I have.

How could I refer to this figure and save time/ my fingers from typing
exactly the same process?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=553325


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Please help me refer to a fixed value.

You could try:

Public Function ThisValue() as String
ThisValue=Sheets("Sheet1").range("A1").value
End Function

You will still have to type ThisValue may times!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help me refer to a fixed value.


Charlie Wrote:
if you Dim the variable at the top of the module (in the General
section) it
will be visible to all sub/functions in that module, and if you declare
it
"Public" it will be visible in the subs of the sheets/workbook, etc.
[/color]

How do I do the "Public" one?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=553325

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help me refer to a fixed value.


i tried putting the following on the top of one of my Modules

Public Const noStores As Integer = Sheets("menu").Range("c7").Value

and within my proceduce

I have

sub test

msgbox noStores
End

but it does not pick up a value for noStores and says Compile error :
constant expression required

where am i going wrong?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=553325



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help me refer to a fixed value.


can anybody help me?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=553325

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to refer a name in VBA clara Excel Discussion (Misc queries) 4 June 26th 08 12:27 AM
How do I keep fixed and Non-fixed decimals on a sheet together? kpike Excel Worksheet Functions 2 June 22nd 06 12:33 AM
drawdown at fixed rate over set period from investment at fixed % jamook New Users to Excel 1 November 28th 05 10:53 PM
averaging from a fixed point to a non-fixed point? Nascent Excel Programming 2 May 24th 04 05:41 AM
Fixed Width - Opening Certain Fixed Width Files Jan[_8_] Excel Programming 2 December 30th 03 08:31 PM


All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"