Tuesday, 1 October 2013

Making an Excel Script

Becoming an Excel master can boost your resume due to the popularity of Microsoft Excel as the go to spreadsheet program for most people. Microsoft Excel is also known for its ability to manage complex functions and equations that can be built by excel experts who have a good understanding of Visual Basic for Applications module which is built into Microsoft Excel. 

If you wish to become a Microsoft Excel expert you must learn to navigate yourself around an Excel program with the aid of Visual Basic.

Let’s try with a simple script writing for which you will first have to open a file whose script you would like to customize.

Press together the ALT + F11 keys to open Visual Basic. You will find a program open to a blank window. On the left of the window there will be two boxes named “Project” and “Properties.”
There will also be a button named “Insert.” Right click on this and select “Module” which will insert a module to the program. A module is a block of code.

Type the following:  "function “function name"()" and a new function will be created. If you wish to create a macro instead, then you will have to replace the function in the above code with “sub.” Press the “Enter” key and the function “End Sub” will appear automatically.

This is known as a routine and your script should go inside it. If you want the values to be returned, key in a statement: “Return.” If you wish for the parameters of this function to be accepted, insert the variables after the function “function function name” mentioned before.

No comments:

Post a Comment