Tutorial on Excel Macros (VBA)      

Excel VBA Consulting

VBA Excel help

Excel functions and formulas

 

VBA for Excel Tutorial

 

VBA for Excel Sitemap

 

VBA for Excel Solutions

 

 

Introduction to VBA for Excel

 

History of VBA for Excel

 

 

 

 

 

 

 

 

 

 

Discovering Macros
VBA for Excel
History

Why the renewed interest in VBA for Excel

The capacity of the computer on your desk and its memory have increased a 1,000 folds in the last 10 years and this personal computer of yours is now part of a network within your company. This network connects you to the world through the Web.

This is why VBA for Excel is now used so much by users of all ages and professional background to develop complex and powerful programs within Excel. These applications can be stand-alone's or back-ends and front-ends to central databases, accounting, sales and manufacturing programs. You can now do things with Excel and VBA that were impossible even 5 years ago.

VBA is a programming language for users who want to make things happen by themselves. VBA is a programming language that can be mastered by anybody even without any programming background.

With VBA you can develop rapidly small macros to get rid of tedious and repetitive tasks but you can also develop large programs that will do exactly what you need at a fraction of the cost of commercial programs that require a lot of training to discover functions that you will never use and other functions that don't really do what you need.

NO COMPROMISE you need what you need.

With VBA the magic word is AUTOMATION. Automate your reports and you analysis. Get results faster.

VBA for Excel allows you to develop the tools that you need at a cost substantially lower than any other programming language . Because you develop them yourself or because you are an important actor in the development process the output is EXACTLY what you need.

You will enslave the technology instead of being enslaved by it.

The History of VBA

In earlier days Excel users would call them MACROS (macro commands). You would assemble a series of keystrokes and Excel would learn and do it for you. It saved time and it saved money. Behind the scene these macros were automatically built using a programming language called VBA (Visual Basic for Application). You can still learn very rapidly how to develop such useful tools using the Macro Recorder. But now you can also go behind the scene yourself and develop very powerful programs within Excel using VBA the easy to learn programming language.

Where does VBA (Visual Basic for Application) come from?

In the '70's a new computer language for non-programmers appeared called Basic. Basic is almost litteraly English. Some of you used it on advanced calculators (TI 59) and on old COCO64 from Radio Shack. At the time, RAM (memory) and CPU's (the brain of the computer) were very, very small and there were limits to what you could do with the language.

With today's computers came Visual Basic (VB). It is still Basic but a lot of elements are pre-programmed making the user's task much simpler. Microsoft adopted the language and introduced it as a component for all its applications (Excel, Access, Word, Project, Power Point...) and called these versions Visual Basic for Application.

What is the difference between VB, VBA for Excel, VBA for Access, VBA for Word, VBA for Project, etc?

To answer this question I will ask you to imagine a meeting of five English speaking persons, a lawyer, an accountant, a physician, a chemist and a psychologist. They all speak English but when it is time to talk about their work none of them totally understand the other. It is the same with VB and VBA's. The objects that you will work with vary from one sub-language to the other. For examples there are cells, worksheets and formulas in Excel but there are none of these things in Word or Power Point otherwise you Delete, ClearContents, Quit, Close and Loop the same way in VB or any of the VBA's.

Basically if you speak English you can easily learn VB or any of the VBA's.

VBA for Excel

VBA for Excel is the most user friendly of the VBA's because of the Macro Recorder that can write sentences for you. The Macro Recorder is not only used by newbies to discover the language but it remains the best teacher along the way (you do anything while recording and you see  how it is written) and the Macro Recorder will remain the greatest assistant (even after 15 years in my case) writing long sentences without typos for you.

The other very friendly part of VBA for Excel is the programming environment. Since the 1997 version of Excel and into 2007 you don't write the code (words and sentences) on one of the sheets you open the Visual Bacic Editor in which you will write your macros and test them. The VBE is as easy to work with as your Email program.

No need to install anything the Visual Basic Editor is already there. Open Excel and click on "ALT/F11" (click and hold the "ALT" key left of the spacebar on your keyboard and press on "F11" at the top of your keyboard. Here is the Visual Basic Editor. Click on "ALT/F11" again and you are back in Excel.

In the VBE you can test your VBA procedures (macros) step by step while seeing them at work directly in your spreadsheet on the same screen. During the test you can modify things, go back a few lines and go on with the test.

So not only is the language easy to learn but the programming tools are also very user friendly.


VBA in Excel 2007

All macros and VBA procedures developed in Excel 1997 and up will work in Excel 2007 except for a function used only by advanced users "FileSearch". It can be easily replaced by "Dir" that runs in Excel 2007 and in earlier versions of Excel.

One other minor change:
Up to Excel 2007 you didn't need to install the Visual Basic Editor. Unfortunately with Excel 2007 you must specify that VBA be installed when you install Excel from the Office CD.

Nothing else has changed in Excel 2007 as far as VBA is concerned. The macro recorder and the Visual Basic Editor are the same...friendly.

 

 
 

Excel VBA Consulting

Excel macros help

Exxcel functions and formulas