-
The Index says it was started by Paul, because his is the earliest dated post I merged into the thread. In fact, I created the thread. SamT
Good Threads post
One master and 30 other WBs -- is the Master the only one with code? Probably not, no one is ever that lucky.
<<Personal Opinion Mode = On>>
For something like that, I'd think first about the architecture of the whole thing first, before I tried to decide if more With/End Withs were needed, etc.
I prefer to seperate the different types of entities some how
1. Control (user commands, system configuration/status,etc.)
2. Data (possibly entry and validation as well as storage)
3. Calculation (possibly by updating other cells or worksheets in the Data)
4. Presentation (reports, pivot tables, charts, a worksheet with JOIN-ed data to make reporting filtering easier, etc.
I typically find that I usually end up going Top Down and Bottoms Up. By that I mean as I worki from the top level, I find that I need a subroutine to do something. I try to make it very general purpose since I know that later I'll probably need to make it smarter to handle something else that I haven't thought about yet. That way I have one sub that will handle many different situations well, instead of many subs that only do one thing.
VERY simple example, in one place I might need to validate that 0<X<100, in another that -10<Y<25, etc. A function: IsXValid(X) works at first, but then later I would need IsYValid(Y).
I try to be alert to oppertunies to make a previous function a little smarter, instead of just quickly writting another one. Instead of writting IsYValid, I'd make the first one IsNumberValid (X, Optional LowVal as long = 0, HiVal as Long = 99999)
Silly example maybe, but the concept works for me, even if it's not 100% effecient and involves re-work.
I ALWAYS go for maintainablity and clarity, even if the code in not tuned to maximum efficency. After all, I'm the person who will have to read the source code in 6 or 24 months and try to figure out just what the heck I was doing
<<Personal Opinion Mode = Off>>
Getting off my soap box now
Paul
Last edited by SamT; 07-03-2015 at 12:37 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules