Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

declarations

ResolvedVersion 2003

Joshua has attended:
Excel VBA Intro Intermediate course

Declarations

How do declarations work in the VBA scripting and when should they/could they be used?

RE: Declarations

Hi Joshua

Declaration statements are used to declare variables.

A variable declaration establishes its name, scope and data type. eg:

Dim UserName as String

They should be used to declare every variable you need in the code.

Furthermore you should always ensure that the Option Explicit statement is in the Declarations area of your code.

Hope this helps

Carlos



 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Make a quick copy of a worksheet

Hold down the Ctrl key, then click and drag on a sheet tab to make a copy of that sheet. Though this process usefully copies the formats of the original sheet, note that any Range Names you have on the original sheet will be duplicated too.

To make a copy of a worksheet's contents and formats without duplicating range names: (1) Ensure that you have a blank worksheet to paste to. (2) On the sheet to copy, click on the sheet selection square to the left of Column A's heading to select the whole sheet. (2) Copy the whole sheet. (3) Paste to the blank worksheet.



View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.