Sie sind auf Seite 1von 11

B EC O M E AW ES O M E I N V B A TO O

Introduction to VBA

| Chandoo.org - 2011

What is VBA?
VBA stands for Visual Basic for Applications. VBA is a programming language which can be used to automate various tasks which often repeat and is the standard programming language used within the Microsoft Office family of products.

| Chandoo.org - 2011

What you can do with VBA?


Automate repetitive / frequent tasks Create your own functions Develop complete applications Create add-ins*

Create custom toolbars buttons / commands

| Chandoo.org - 2011

Who should use VBA?


Almost anyone who has a good knack of Excel may use VBA. Those who want to do more with Excel. You, me and everyone

| Chandoo.org - 2011

How to use VBA


You need to have anyone Microsoft Office product installed on your computer to use VBA.

The VBE (Visual Basic Editor) is used to write your own code using VBA.
Please look at the video How to Launch VBE for better understanding of

launching VBE.

| Chandoo.org - 2011

What are Variables


A variable is simply put a storage location in the RAM (memory of your computer) which can be referred to by a name and can be modified when

running the code. We make use of the variables that we define in our code
to hold data and make use of the same to do more work. It is always suggested to give a proper name (instead of x, y and z) to a variable so that identification of the same is easier when we have lots of them.

| Chandoo.org - 2011

What are Variables (contd.)


Variables can be of different types as per our requirements Public Variables Private Variables Static Variables

User Defined Variables (aka Types)

| Chandoo.org - 2011

What are Procedures/Sub?


A procedure/sub is a named unit of code in sequence which are executed one line after the other.

We make use of procedures often to divide our code into segments which
maybe repeated as and when required.

| Chandoo.org - 2011

What are Objects?


Objects are logical units that have Properties Methods Events.

For example A Pen is an object. A Pen is available in different colors


(Color property) Can be used to write (Write method) When writing ink flows (flow event)
| Chandoo.org - 2011

What is a Function?
A function is similar to a procedure with the only difference being that we pass a few parameters/arguments for the function to work on and then it

will return a single value to us after the code has been executed.
We use a lot of in-built functions in Excel almost everyday. For example: the Sum function, Average function etc. We can define our own functions using VBA.

| Chandoo.org - 2011

Thanks

| Chandoo.org - 2011

Das könnte Ihnen auch gefallen