VBA objects and properties in Excel

An Object, in simple terms, is a physical entity that has existence.

In Programming also, an Object is an entity and its characters and specifications are defined by properties and methods.

Most of the programming languages are object oriented and VBA is no exception, except that, it is not fully object oriented.

This means, VBA does not have all the specifications as defined in the OOPS theory, but it does deals with objects.

For example, Excel worksheet, workbook,Range, Cells, all are treated as objects.

The Left side panel of the VBA editor shows the list of objects as shown below

excel vba objects and properties

So What are Properties?

Properties are nothing but the characteristics of the objects that are measurable and can be quantified.

For example, a Sheet is an object but its Name is a property.Yes, it has a property named "Name".

Similarly, a Range object has Font property, Colorindex, Value property and so on.

The following example illustrates these concepts. For this we created the Sheet Q25.

  1. Sub objects_example()
  2. Sheets("Q25").Range("F26").Value = "Test"
  3. Sheets("Q25").Range("F26").Interior.ColorIndex = 5
  4. MsgBox "Properties demo; See F26"
  5. Sheets("Q25").Range("F26").Clear
  6. End Sub

The Screenshot of the editor is as shown below

excel vba objects and properties

 

You can find similar Excel Questions and Answer hereunder

1) How can I edit data in multiple WorkSheets together?

2) How to avoid screen update in Excel VBA. Various application objects explained

3) How do you close, save, open files and do other operations in the workbook in VBA

4) Introduction to tables in Excel VBA and how to use tables, create tables in VBA

5) what are the main range object and what can the range objects do in VBA

6) How to print a worksheet in Excel

7) How do I enter a formula in a cell using VBA (using Relative Reference)?

8) How to add email and emailing function in Excel VBA

9) Here we explain the thisWorkbook object and its functionalites

10) what are the main range object and what can the range objects do in VBA

 

Here the previous and next chapter