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

excel

ResolvedVersion 2003

Scott has attended:
Excel VBA Intro Intermediate course

Excel

how do you declare a public variable

RE: excel

Hi Scott

A public variable is a variable that can be accessed by all the sections of code in a project.

One example of the use of a Public variable is data being entered on a form that needs to be moved to a module.

As a good coding practice you should declare the public variable in the Option Explicit area of the code page

To declare a Public variable you use the following code

Public MyVariable As String

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:

Entering text in Multiple Worksheets

If you have a number of worksheets in a workbook that require the same information (data or tables) on each worksheet, this can be done as follows:

Hold down the Ctrl key and click one or more of the additional worksheet tabs (i.e. Sheet2, Sheet3, etc).

In your mainsheet (Sheet1) enter the required data or design a table.

When done 'Click' on the other sheet tabs and you will see that the information entered in Sheet1 is on all the other selected worksheets.

NB Do not forget to deselect the worksheets - otherwise you may add data to the main worksheet and all the selected worksheets will also have that data!

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.