Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I agree that the value of the cell makes a perfectly good Global variable.
I dont see any advantage to the function and I would not bother with the range name. The following is an example of how I might do it: Sub testit2() Dim strMode As String strMode = ThisWorkbook.Worksheets("First Sheet").Range("A1").Value If strMode = "test" Then 'Do what ya gotta do. End If If strMode = "Live" Then 'Do what ya don't gotta do. End If End Sub I like the blnHasRun routine that Jim posted but would note two things: 1) Each time the workBOOK is opened it will be reset to False and run the routine the first time the workSHEET is activated. If that is not desirable you could use the value of a cell in the worksheet as the variable. 2) The code will need to be copied to each worksheet for which you want it to apply. I hope this helps. Tom |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
LookUP function with multiple variables and worksheets | Excel Worksheet Functions | |||
Overflow error when declaring variables | Excel Discussion (Misc queries) | |||
Declaring variables in Module vs. Public | Excel Discussion (Misc queries) | |||
Declaring variables | Excel Discussion (Misc queries) | |||
Declaring variables | Excel Discussion (Misc queries) |