Tuesday, May 19, 2009

Excel VBA Objects

Most programming languages today deal with objects, a concept called object oriented programming. Although Excel VBA is not a truly object oriented programming language, it does deal with objects. VBA object is something like a tool or a thing that has certain functions and properties, and can contain data. For example, an Excel Worksheet is an object, cell in a worksheet is an object, range of cells is an object, font of a cell is an object, a command button is an object, and a text box is an object and more.

An Excel VBA object has properties and methods. Properties are like the characteristics or attributes of an object. For example, Range is an Excel VBA object and one of its properties is value. We connect an object to its property by a period(a dot or full stop). The following example shows how we connect the property value to the Range object.

Example 8.1

Private Sub CommandButton1_Click()
Range("A1:A6").Value = 10
End Sub

In this example, by using the value property, we can fill cells A1 to A6 with the value of 10. However, because value is the default property, it can be omitted. So the above procedure can be rewritten as

Example 8.2

Private Sub CommandButton1_Click()
Range("A1:A6")= 10
End Sub

To learn more about Excel VBA, log on to VBA tutorial site:

http://www.vbtutor.net/VBA/vba_tutorial.html

1 comment:

Anonymous said...

Hello !.
You may , probably very interested to know how one can make real money .
There is no initial capital needed You may begin earning with as small sum of money as 20-100 dollars.

AimTrust is what you thought of all the time
The firm represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

Its head office is in Panama with structures everywhere: In USA, Canada, Cyprus.
Do you want to become really rich in short time?
That`s your chance That`s what you desire!

I`m happy and lucky, I started to get income with the help of this company,
and I invite you to do the same. It`s all about how to select a correct companion who uses your money in a right way - that`s the AimTrust!.
I earn US$2,000 per day, and my first deposit was 1 grand only!
It`s easy to start , just click this link http://orosoluke.envy.nu/bekodubo.html
and lucky you`re! Let`s take this option together to get rid of nastiness of the life