View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Public Array in a form?

Declare it as public in a general module and it will be visible/usable in
all modules.

--
Regards,
Tom Ogilvy

"lux770" wrote in
message ...

Hi,

I am trying to create a user form that toggles the spreadsheet view
between the normal cells interior colors and colors that depend on the
cell content (e.g. yellow for a formula etc.)
I have created the form and the procedures that actually perform the
actions. My problem is that when loading the form, I want to store the
color of each cell of the UsedRange in an bi-dimensional array, so that
I can restore the original colors of the spreadsheet (making sense so
far? )
That array needs to be public because I will need to use it in several
procedures such as togglebutton1_change, userform_terminate etc.
Therefore I have tried to delare it at the top of the form's code as a
public variable.

Unfortunately I get the following message: "-Constants, fixed-length
strings, arrays, user-defined types, and Declare statements not allowed
as Public members of an object module-"

The VBA help suggests to "-use a set of Property procedures that accept
and return a Variant containing an array-", but I am afraid I have not
reach that level of competency yet. :( Could someone explain to me in
detail what I should do?
Many thanks!


--
lux770
------------------------------------------------------------------------
lux770's Profile:

http://www.excelforum.com/member.php...o&userid=24970
View this thread: http://www.excelforum.com/showthread...hreadid=390558