View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Manville Bill Manville is offline
external usenet poster
 
Posts: 473
Default Best place to declare variables

Taras wrote:
Is it more efficient to declare the variables with DIM in
Module A & Module B or to declare them as Public
elsewhere?


Module-level variables (whether Public or not) have space permanently
allocated. So having 2 sets will consume twice as much space.

However, I would not advocate using Public variables in case you end up
changing the sequence in which things are done and get conflicting
usage of the same variable between procedures in different modules.


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup