![]() |
declaring public variables
Hi there
The following is most bizarre! In my VBA project I've declared several public variables as normal (ahead of all procedures) ... Public ctrNegInv, ctrPosInv As Integer, etc. I set the values in one procedure and then execute a second procedure but, when the variable is encountered in the second procedure, it appears to be empty and I get a "Subscript out of range" error. For instance, if I hover the cursor over the variable in the variable declarations section, it says ctrNegInv = Empty, whereas if I hover the cursor in the procedure where I set it's value it says ctrNegInv=0, and further if I hover the cursover in the subsidiary or later procedures I get ctrNegInv = Empty. Can I be going mad? Best regards Loane |
declaring public variables
Hi Loane,
You aren't declaring the same variable in one of those procedures by any chance? -- HTH RP (remove nothere from the email address if mailing direct) "Loane Sharp" wrote in message ... Hi there The following is most bizarre! In my VBA project I've declared several public variables as normal (ahead of all procedures) ... Public ctrNegInv, ctrPosInv As Integer, etc. I set the values in one procedure and then execute a second procedure but, when the variable is encountered in the second procedure, it appears to be empty and I get a "Subscript out of range" error. For instance, if I hover the cursor over the variable in the variable declarations section, it says ctrNegInv = Empty, whereas if I hover the cursor in the procedure where I set it's value it says ctrNegInv=0, and further if I hover the cursover in the subsidiary or later procedures I get ctrNegInv = Empty. Can I be going mad? Best regards Loane |
declaring public variables
Is the variable declared in a standard module, the type you get with
Insert=Module and in the same project as the procedures that want to use it? -- Regards, Tom Ogilvy "Loane Sharp" wrote in message ... Hi there The following is most bizarre! In my VBA project I've declared several public variables as normal (ahead of all procedures) ... Public ctrNegInv, ctrPosInv As Integer, etc. I set the values in one procedure and then execute a second procedure but, when the variable is encountered in the second procedure, it appears to be empty and I get a "Subscript out of range" error. For instance, if I hover the cursor over the variable in the variable declarations section, it says ctrNegInv = Empty, whereas if I hover the cursor in the procedure where I set it's value it says ctrNegInv=0, and further if I hover the cursover in the subsidiary or later procedures I get ctrNegInv = Empty. Can I be going mad? Best regards Loane |
All times are GMT +1. The time now is 03:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com