Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did you declare it at the top of the module outside any sub/function.
These variables hold there value between code executions. You can see what happens in a test module: Option Explicit Dim iCtr As Long Sub testme01() iCtr = iCtr + 1 MsgBox iCtr End Sub Sub testme02() Dim jCtr As Long jCtr = jCtr + 1 MsgBox jCtr End Sub Did you declare the variable as Public in a different module? That makes it visible to all the modules and it'll also retain the current value between executions. Did you declare the variable as static? Sub testme03() Static lCtr As Long lCtr = lCtr + 1 MsgBox lCtr End Sub I'm guessing that it's a public variable in a different module. Hit Ctrl-F (Edit|Find) within the VBE and search for that variable name. But make sure you check the "current Project" option button. Then hit Find Next (or F3 when you dismiss that Find dialog). Jon wrote: When I execute a piece of code (pressing f8 once), and I hover the cursor over a variable, I find that there is value already assigned. I can't find this in the declaration section or anywhere else where this value gets assigned. Does anyone know how this can happen? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
assigned cell names | Excel Discussion (Misc queries) | |||
Save assigned button | Excel Discussion (Misc queries) | |||
How do I know what macro is assigned to a button? | Excel Discussion (Misc queries) | |||
fourmla with result no less than assigned value | Excel Worksheet Functions |