Objects

Excel has a large number of objects, and the VBA allows us to easily create and manipulate them. We can declare variable as an object by specifying the variable name and the object name as a type. Then, using the Set command, we assign the actual object to a variable. Once this is done, we can change its properties or run methods – subroutines that allow further manipulation of objects.

The best way to figure out how this works is through the example. Below you can see a short program in which we create a variable as a Worksheet object. Further we set that this is the first worksheet in the document. Finally, by using Cells property, the value of 100 is entered in cell A1.

Dim RadniList As Worksheet
Set RadniList = Worksheets(1)
RadniList.Cells(1, 1) = 100