Rapid Application Development / Advanced Excel Development

 
Products for Excel
Commercial Products:
  - Classic Ribbon
  - Alt-FileSearch
  - Password Remover
Spreadsheet Quality Products
Free Products
Excel Development
Excel Development Index
Excel VBA
- VBA IDE (editor)
- VBA Training
- VBA Best Practice
- VBA Performance
- COM Performance
- VBA Security
Excel and Databases
Excel and Pivot Tables
Excel Add-ins
Worksheet Functions
Excel and xlls
Excel (in)security
Excel testing
Excel and .net
Excel External Links
Excel Developer Types
Professional Excel Development
Excel 2007
Excel 2010
Excel Development Archive
Spreadsheet Services
Spreadsheet Development
Spreadsheet Migration
Spreadsheet Maintenance
Spreadsheet Review
Spreadsheet Management
Resources
Excel User Confs
Consultant Profile
Book Reviews
Links
Other
Site Map

Spreadsheet Quality

Spreadsheet Design Concepts Series

VBA Connection

  • VBA UDFs should get all range info via parameters
  • Where (non UDF) VBA uses worksheet ranges, these should almost certainly be named ranges.
    • Sheet1.Range("Inflation").value = 0.02, or Sheet1.[Inflation].value = 0.02, rather than
    • Sheet1.[C5].value = 0.02, which may become invalid if rows or columns are inserted or deleted
    • strInflationRange = "C5" is just as bad - it creates a hidden dependency that must be manually updated when worksheet changes (poor coupling)
  • Variable and routine names:
    • Use very meaningful names (8-30 chars length)
    • Use a simple naming convention (matched pairs)
    • Use scope prefixes (g, m), and minimise it
    • Don't have to use data type variable prefixes (s, str, l, lng etc) (see .net advice)
    • avoid abbreviations
  • Don't use code comments demo make code ultra clear instead
  • Option Explicit on
  • Avoid Application.Run (non VBA - breaks error management)
  • routines 1 screen long max
  • 3-4 levels of nesting max
  • Use source control

Fuller information about VBA Best Practice (according to Codematic, of course - everyone has their own view) is here.

Of course all this is great in theory, but one of the key elements of professionalism is knowing when to go against so called best practice.

 

 

Products for sale:

AltFileSearch

New information about the missing FileSearch feature in Office 2007 and details of our pragmatic solution (Current price GBP 25.00 + Vat)


wsUnprotector

Instant Excel worksheet protection remover and password recovery (Current price GBP 15.00 + Vat)


Classic Ribbon Tab

Add Excel 97/2000/2002/2003 compatible menu structure to Excel 2007
(Current Price GBP 10.00 + Vat)


 

Products coming soon:

XLAnalyst Pro

(Excel VBA based spreadsheet auditing tool)

Due before the end of 2009.

   
This page was last reviewed on November 30, 2009

©Codematic Ltd 1999-2009