Indirection Be Done In VBA

Jul 11, 2008

I suppose I'm hoping the answer is 'no', having once inherited a system written in M+ where a scally contract developer had used 3 or more levels of indirection to make the system totally unmaintainable by anyone except himself (easiest option was to rewrite it which alas for him made the contractor unnecessary). Also if you recurse on an indirected variable you swiftly crash the op system stacks.

It's simple enough to indirect to references on the worksheet, but I just wondered if you can indirect on variable names in VBA? There's nothing in the help file so I assume not.

View 9 Replies


Sheet Indirection. Refer To Sheets With Changing Names

Feb 25, 2008

I've been referencing sheets in my code directly with things like

Sheet1. Range(NamedRange)

however in recreating a new workbook (to reduce bloat), the sheet-numbering has changed... to avoid having to mess around adjusting things again, I was wondering if it's possible to do some sort of indirection... something similar to

#define SHEET_SC_CONFIG Sheet1
#define SHEET_CUSTOMER Sheet2

'and then use these throughout the code....

(cannot reference by sheet name, as end user may change these)

View 6 Replies View Related

Copyrights 2005-15, All rights reserved