Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Here's a very basic question that I'm embarassed to ask, but nothing
ventured, nothing gained. The cause of my problem stems from the lack of understanding the whole archectecture of environments. I create a procedure and it seems as though I have no control of where it goes. Sometimes they get nestled together, separated by a simple line and othertimes I have to go back to the menu and specifically select the next module. More important, is that when I create and fill a variable in one routine, even if it is declared (by default) as a Public, I cannot seem to use it in the next routine. Can someone direct me to a good place to start looking to get a better understanding of this subject matter. Thanks in advance, Craig |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You might start by reading the responses to this discussion:
http://www.microsoft.com/office/comm...304&sloc=en-us Just to give you a kick-start, there are 4 places in an Excel workbook that code can be located: #1 - code modules not associated with the workbook/worksheets (can be referenced from more specific code areas) #2 - code associated with the workbook events #3 - code associated with woksheet events (one for each worksheet) #4 - code associated with UserForms A Public variable/constant to be accessed from anywhere at all must be declared in one of the #1 type code modules and it must be declared outside of a Sub or Function. So those Public values would be at the very beginning of the module, before any Sub or Function code in it. If you declare a variable/constant with the same name as a Public one, then the one declared within the Sub/Function will be used instead of the Public one. This is all about 'scope'. So you may want to focus on that subject in your initial reading. Good luck. "C Brandt" wrote: Here's a very basic question that I'm embarassed to ask, but nothing ventured, nothing gained. The cause of my problem stems from the lack of understanding the whole archectecture of environments. I create a procedure and it seems as though I have no control of where it goes. Sometimes they get nestled together, separated by a simple line and othertimes I have to go back to the menu and specifically select the next module. More important, is that when I create and fill a variable in one routine, even if it is declared (by default) as a Public, I cannot seem to use it in the next routine. Can someone direct me to a good place to start looking to get a better understanding of this subject matter. Thanks in advance, Craig |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Import into Access from Excel, passing a variable for the field... | Excel Worksheet Functions | |||
Transpose a variable length list into Excel / Access Table | New Users to Excel | |||
Trying to access different files depening on a variable | Excel Discussion (Misc queries) | |||
variable height variable width stacked bar charts | Charts and Charting in Excel | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions |