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

vba courses london - brackets after sub name

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Brackets after the sub name

vba courses london - Brackets after the sub name

ResolvedVersion Standard

Matt has attended:
Access VBA course

Brackets after the sub name

Hi,

Could you let me know what I should use the brackets for after the initial sub command?

ie. Sub ThisMacro()

I remember it is used to define something but also remember that it wasn't used in every case.

Thanks,
Matt

RE: Brackets after the sub name

Hi Matt

The brakets are used to declare variables/arguments.


ie
Function sumNo(x, y)
sumNo = x + y
End Function


So in the above example, you would type in excel

=sumNo(3,5)

and the answer would be 8

Alternatively you could use cell references

=sumNo(A1,A2).


Regards

Richard

 

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.

VBA tip:

Good coding practice

It is important that you always comment the VBA code that you write. By doing this it will make the code much easier to read, as both yourself and other people will be able to see what the code is doing or meant to be doing. This is very important if there is more than one person who writes code in the company as you may have different styles of coding and may not really understand what the other person is trying to do. Also if you write some code and then do not touch it for a year or so you may actually forget what it is meant to be doing. so it is very important to include comments throughout your code and try and make sure that they are as useful as possible

View all VBA hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.