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. Excel 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, a cell in a worksheet is an object, a range of cells is an object, the font of a cell is an object, a command button is an object, and a text box is an object and more.
Author: Liew Voon Kiong
Creating VBA in Microsoft Excel 2010
Adding an active x control in Microsoft Excel 2010 is not as obvious as in the earlier versions of MS Excel. The default worksheet in Microsoft Excel 2010 does not show the controls.
In order to bring up the controls, you need to make the developer tab visible. To display the developer tab, click File and then click Options. In the Options dialog, click Customize Ribbon and under Main Tabs check the Developer box, as shown in the Figure below:
Now your Microsoft Excel workbooks shows the Developer tab and the ActiveX controls are available there, as shown in the Figure below:
Formatting Font and Background Colors in Excel Spreadsheet
We can write Excel VBA code to format the color of a MS Excel spreadsheet. Using Excel VBA code, we can change the font color as well as the the background color of each cell effortlessly.
Alright, let’s create a program that can format random font and background colors using a randomize process. Colors can be assigned using a number of methods in Excel VBA, but it is easier to use the RGB function. The RGB function has three numbers corresponding to the red, green and blue components. The range of values of the three numbers is from 0 to 255. A mixture of the three primary colors will produce different colors.
More details here:
Creating Animation in Excel VBA
Though generally we create Excel VBA code for mathematical and financial calculations, it is also possible to creating some fun applications in Excel VBA, including games and animation. Although professionals programmers might not be interested to write such applications, it is worth while trying them out as a hobby and for personal satisfaction.
Visit this link to find out more:
Formatting Functions in Excel VBA
Formatting output is a very important part of Excel VBA programming so that the data can be presented systematically and clearly to the users. Data in the previous lesson were presented fairly systematically through the use offunctions like Int, Fix and Round. However, to have better control of the output format, we can use a number of formatting functions in Excel VBA.
Read more about formatting functions at:
Excel VBA Functions
In Excel VBA, a function is similar to a procedure but the main purpose of the function is to accept a certain input from the user and return a value which is passed on to the main program to finish the execution. There are two types of functions, the built-in functions (or internal functions) and the functions created by the programmers, or simply called user-defined functions. We shall deal with built-in functions in this lesson and the user-defined functions in the next lesson.
The first built-in function that we have already learned and familiar with its usage is the Message Box. We are not going to repeat here but we shall take a look at its syntax once more, i.e.
message=MsgBox(Prompt, Style Value,Title)
Now we shall examine the next commonly used function in Excel VBA, it is none other than the InputBox function.
Read more about functions at: http://excelvbatutor.com/index.php/excel-vba-lesson-8/
Animation in Excel VBA
Can you imagine you can create animation in Excel VBA? The answer is YES! Please click on the following link to learn about Animation in Excel VBA.
Welcoming Message from the Webmaster
We have transferred the entire Excel VBA tutorial website to this new domain. The main objective is to provide a more user-friendly learning environment to learn Excel VBA macro programming. It is still in the building process, we hope that you can provide your useful feedbacks for us to build a better website. Thank you!