coding conventions and project
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Coding conventions and project structure conventions

Coding conventions and project structure conventions

resolvedResolved · High Priority · Version 2003

replyReply Fri 8 May 2009, 16:10Delegate Claudia said...

Claudia has attended:
Excel VBA Intro Intermediate course
Excel VBA Intro Intermediate course

Coding conventions and project structure conventions

When writing code, the best conventions for storing private and public variables, make it easier to call procedures. When passing codes to colleagues, everyone will understand the conventions.

For upcoming training course dates see: Pricing & availability

replyReply Wed 13 May 2009, 08:51Trainer Stephen said...

RE: Coding conventions and project structure conventions

Hi Claudia

Thank you for your question

Writing code so that it is easily understood is a common challenge, and the following guidelines will help.

1. Always use naming conventions when declaring variables. For instance an integer variable might be prefixed with "int" a string "str" and son on. This makes it easier to understand what is happening to the code as it runs.

2. Give procedures meaningful names, so that it is clear what actions they are carrying out.

3. Always indent your code properly. Every line of code should be indented once within the procedure, and then always indent code within a loop, decision structure or with block. This allows the structure of your code to be more apparent.

4. Finally, use remarks liberally.Every major line of code should have explanatory remarks associated with it. When in doubt, annotate it.

Hope this helps

Regards

Stephen

Tue 19 May 2009: Automatically marked as resolved.

 

Please browse our web site to find out more about
vba for excel training and other Microsoft training courses.

Excel tip:

Sum Up All the Values in A Column

If you want to quickly calculate the Summed values of all cells in a column in Excel 2003 normally you would use the SUM formula. (eg if you wanted to calculate the values in Column C rows 10 to 25) the formula would be:

=SUM(C10:C25)

However, if you keep adding values to column C you would keep having to modify the above SUM formula which can get quite annoying.

To get around this you can sum all the values in a column using the following formula:

=SUM(COLUMN:COLUMN)

Which, in our example, would be:

=SUM(C:C)

NOTE You cannot place this formula in column C, or else Excel 2003 will show a circular reference error.

The formula must be placed in any other column, EXCEPT the one being calculated.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard