Excel VBA Methods

Basic Description

An example of an object method is Quit:

Application.Quit

To Quit is to do something, which is why it’s a method rather than a property. If you’re not sure whether something is a method or a property, try putting the word “to” before it. To Quit makes sense, but to Font doesn’t. So Font would not be a method.

Another example of a method is Add. You can use this to add a new worksheet to your Excel workbook:

Worksheets.Add After:=Worksheets(1)

The object above is Worksheets. The Add method comes after a dot. Next, we have a space. One parameter of the Add method is called After. The value for After is the name of a worksheet. (Inside the round brackets you can have either the name of a worksheet in double quotes, or a number. The number 1 means worksheet 1 in the current workbook.)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

code

clearPost Comment