Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Variable Not Defined

I just received a report from a user testing a workbook in work, that a
variable is not defined in the procedure. What's strange is that the
variable is defined. Has anyone else seen this problem and what is the
solution.

FWIW, I have option explicit on every module and when I compile the code,
there are times when errors like this aren't captured. Has anyone seen that
as well?

Thanks,
Barb Reinhardt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Variable Not Defined

I've seen this problem with arrays

Dim abc as variant
and
Dim abc() as variant

are two diffferent variables.

"Barb Reinhardt" wrote:

I just received a report from a user testing a workbook in work, that a
variable is not defined in the procedure. What's strange is that the
variable is defined. Has anyone else seen this problem and what is the
solution.

FWIW, I have option explicit on every module and when I compile the code,
there are times when errors like this aren't captured. Has anyone seen that
as well?

Thanks,
Barb Reinhardt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Variable Not Defined

I have definitely seen the situation where I have Option Explicit, as I
always do, and a non-declared variable is not picked up on compile. When
executing the code, it only gets picked up when that path is traversed. I
have never been able to spot a common situation, but it is far more regular
than I would like.



Bob

"Barb Reinhardt" wrote in message
...
I just received a report from a user testing a workbook in work, that a
variable is not defined in the procedure. What's strange is that the
variable is defined. Has anyone else seen this problem and what is the
solution.

FWIW, I have option explicit on every module and when I compile the code,
there are times when errors like this aren't captured. Has anyone seen
that
as well?

Thanks,
Barb Reinhardt



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Variable Not Defined

Oh, as an aside I have a line similar to this in all procedures

Const mpProcedure As String = "procedure_name"

which also fails regulalrly on compile, and I have to remove that line and
re-type it. Then all is well (?).

--
__________________________________
HTH

Bob

"Barb Reinhardt" wrote in message
...
I just received a report from a user testing a workbook in work, that a
variable is not defined in the procedure. What's strange is that the
variable is defined. Has anyone else seen this problem and what is the
solution.

FWIW, I have option explicit on every module and when I compile the code,
there are times when errors like this aren't captured. Has anyone seen
that
as well?

Thanks,
Barb Reinhardt



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable not defined? davegb[_2_] Excel Programming 5 March 20th 08 02:53 PM
Public Variable - not defined? Clayman Excel Programming 8 July 27th 07 01:24 PM
variable not defined Carlee Excel Programming 2 April 26th 07 08:56 PM
For Each cell - Variable not defined (VBA) Shlomit Excel Programming 2 January 25th 07 08:39 AM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM


All times are GMT +1. The time now is 03:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"