Where to write code for VBA?
Posted on 2004-04-06
Just as a clarification for best practice, can someone tell me........?
Say, I open Excel. I have Book1. I go into VB Editor, and I see in the project tree that I have VBAProject(Book1). And if I open another new Worksheet, I get VBAProject(Book2). Then under VBAProject, the tree breaks into "Microsoft Excel Objects", which then further breaks down into "Sheet1", "Sheet2"......"This Workbook".
My question is, I have an option of inserting a "MODULE", "CLASS MODULE" and "USER FORM". When I write code, what should be put in where??????? for the sake of better code organization etc........????
I used to put everything into "This Workbook", but then it becomes a whole page of procedures.........
I'm only using Excel as an example, but I do alot of other VBA stuff for Engineering Applications. Can someone please clarify the ussage of modules, objects, etc.....???