Public Variable gone

Ricardo Caicedo

New Member
Joined
Aug 21, 2014
Messages
43
Good Morning guys

I have a problem with a Public Variable. I declare a PUBLIC WaveN as Integer in a general module, so I suppose the amount should be keep it all the time during the running.

The program UpdateMaster assign to the public variable WaveN a number after go through many rows (inside of this module), but then the following program TransferInfo needs that value. I got "on" the debug mode and I can see that as soon the first sub close the value just gone.

My code is follow:</SPAN>
Sub RunProgram()</SPAN>

Call UpdateMaster
Call TransferInfo
Call RangeLookFill
Call SplitInfo
Call UpdateFinal</SPAN>
End Sub</SPAN>


Any Ideas....do I have to put the UpdateMaster(WaveN) format?
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,779
Office Version
  1. 2010
Platform
  1. Windows
Is there an End statement somewhere in the code?
 

Ricardo Caicedo

New Member
Joined
Aug 21, 2014
Messages
43
Good morning shg. I got and end select for error handling but i think this one is not creating the problem.

The code is large, but I can see in debug mode that before the "end sub" of this module, the vatiable keeps the value, but as soon close the module the variable get <out of context> so the value is gone.
 

Ricardo Caicedo

New Member
Joined
Aug 21, 2014
Messages
43
I found that it works if you declares public in a separate module and also the debug program shows the wrong information as the variable keeps the value through all the execution, but it shows as 'Out of context".

Thank you for your help
 

Watch MrExcel Video

Forum statistics

Threads
1,122,335
Messages
5,595,573
Members
413,996
Latest member
mabelO

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top