View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Updating public array within a form


I had a Dim statement within my master code which seemed to be overriding
the public statement.


What you have encountered is an illustration of a programming concept
known as "scope". See http://www.cpearson.com/Excel/Scope.aspx for a
full discussion as it applies to variables, classes, and procedures.

Cordially,
Chip Pearson
Microsoft MVP
Excel 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Fri, 13 Nov 2009 07:17:02 -0800, Paul
wrote:

Mike

I've found it !!

I had a Dim statement within my master code which seemed to be overriding
the public statement.

Remove the DIM and all is well.

Thanks anyway for taking the time

"Mike H" wrote:

Paul,

As usual, post your code.

Mike

"Paul" wrote:

I have a form that requires user input to a number of boxes.

As each is updated I would like to update the array element to which it
relates.

I have stated my array as public in the code that calls the userform, but as
soon as I'm in form code I get a 'Subscript out of range' error.

Any ideas where I'm going wrong ?