Anyone use VBA in Excel: eclaring Arrays as Public

  • Thread starter Thread starter Saladsamurai
  • Start date Start date
  • Tags Tags
    Arrays Excel
Click For Summary
SUMMARY

The discussion centers on the use of VBA in Excel, specifically regarding the declaration of arrays as Public. A common error identified is the incorrect placement of code within a worksheet instead of a standard module, which prevents the Public arrays from functioning as intended. The resolution involves moving the code to a module to ensure proper accessibility of the declared arrays.

PREREQUISITES
  • Familiarity with VBA (Visual Basic for Applications) in Excel
  • Understanding of module vs. sheet code structure in Excel
  • Knowledge of array declaration and scope in programming
  • Basic troubleshooting skills in Excel VBA
NEXT STEPS
  • Learn how to create and manage modules in Excel VBA
  • Study the differences between Public and Private variables in VBA
  • Explore best practices for organizing VBA code in Excel
  • Investigate common errors in VBA and their solutions
USEFUL FOR

This discussion is beneficial for Excel users, VBA developers, and anyone looking to enhance their programming skills in Excel by understanding the proper use of Public arrays and module organization.

Saladsamurai
Messages
3,009
Reaction score
7
Anyone use VBA in Excel::Declaring Arrays as Public

Egads man...I have seen plenty of modules with arrays declared as Public. Clearly I am making some boneheaded error here and cannot locate it:

ExcelError.jpg


Any Thoughts?
 
Technology news on Phys.org


Solved:

After some searching I found that the error is because I wrote my code in a sheet and not a module... :/
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
8K
Replies
8
Views
3K
  • · Replies 23 ·
Replies
23
Views
2K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
Replies
235
Views
15K
  • · Replies 31 ·
2
Replies
31
Views
3K
Replies
6
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K