PDA

View Full Version : Solved: Error::Can'tDeclare Array as 'Public' ::What is Excel's Problem now?



Saladsamurai
11-17-2009, 01:36 PM
I have seen plenty of modules with arrays declared as Public. Clearly I am making some boneheaded error here and cannot locate it:

http://i12.photobucket.com/albums/a220/saladsamurai/ExcelError.jpg

Thoughts?

Saladsamurai
11-17-2009, 02:23 PM
After some searching I found that the error is because I wrote my code in a sheet and not a module..... :/

Bob Phillips
11-17-2009, 03:20 PM
You can have public variables in a sheet module.

Sheet modules are implicitly declared classes, so a public vraiable in a sheet module is a property of that class.

Saladsamurai
12-04-2009, 05:55 AM
You can have public variables in a sheet module.

Sheet modules are implicitly declared classes, so a public vraiable in a sheet module is a property of that class.

It's all Chinese to me, but when I moved it to a module it worked just fine. Same exact code; different location.

I have successfully used Public variables in a sheet before, which is why I was so confused. For some reason, a Public Array is a problem in a sheet.

Bob Phillips
12-04-2009, 08:03 AM
Can't see why, an array is just another type of data.