recording macro

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

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Recording Macro

Recording Macro

resolvedResolved · Low Priority · Version 2003

Akiko has attended:
Excel VBA Intro Intermediate course

Recording Macro

I am not sure exactly when I should use

Edited on Thu 24 Jul 2008, 12:12

Variable Scope Dim vs Public

Hi Akiko

If you declare a variable as Dim it sets it up to be seen only by the procedure or module that contains it. For example:

Sub Test()

Dim MyName as String

MyName = "Carlos"

End Sub

If I wanted to access the value of MyName from another procedure it wouldn't find it.

So if the variable you are declaring needs to be accessible by all procedures and modules in a project then it needs to be declared as Public. For example:

Public MyName 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:

Conditional formatting for cells that return text , not picked up by Go to command

If you have tried to format all cells containing text even those that display text as a result of a formula you may have had difficulty. As Go to command with constant selected does not pick up formulas that result in text.

Then try this. Select the range the formula cells appear in on your sheet. Format, select Conditional Formatting menu. In the dialog box under Condition 1, select "Formula Is" from drop down. Next to it in the Formula Box, enter the formula =Istext(A1. Click Format button , choose desired formatting settings and click OK. To go ahead and apply the conditional formatting click OK to accept

View all Excel hints and tips


Server loaded in 0.08 secs.