Spoken Language: English
Business: Education and Training, Information Technology
Excel-vba-easy.com teaches you how to create all sorts of macros in Excel VBA<. It doesn't matter if you are new to Excel VBA and want to start from scratch or just want to use our tutorial as a reference. We keep it simple!
Excel VBA, which stands for Excel Visual Basic for Applications, is the name of the programming language of Microsoft Excel. With Excel VBA you can automate a task in Excel by writing a so called Macro. This can save you a lot of time! More importantly there are certain things you cannot do with Excel alone. Excel VBA allows you to do these things in Excel.
Excel VBA help<
Excel VBA basics<
It is good to know the basic terminology explained in this section before you start programming in Excel Visual Basic.
- Macro Security:
- Setting up your macro security settings correctly is essential to protect yourself against potential viruses. Make sure your macro security settings are set up correctly so no harm can be done to your computer.
- Visual Basic Editor:
- Learn how to launch the Visual Basic Editor and get the best configuration of the Project Explorer and the Code Window in your Excel Version. The Visual Basic Editor is the starting point for creating macros in Excel VBA, so it is important to get this configuration right.
- Macro Comments:
- Add macro comments to your Excel VBA code and your code will be easier to read as program size increases.
- The Message Box is a dialog box you can have appear to inform the users of your program.
- Macro Errors:
- Dealing with VBA-errors can be quite a challenge. This chapter provides you with a simple tip to deal with these errors.
- Debug Macros:
- Before you execute your VBA-code you can first debug your macro. This way most of the errors can be corrected before you execute your code.
- Objects, Properties and Methods:
- In this chapter you will learn more about Excel VBA objects. An object has properties and methods. Excel Visual Basic is a semi-object oriented programming language. Learn more about the object hierarchy of Excel Visual Basic.
- Workbook and Worksheet:
- In this chapter you will learn more about the Excel VBA Workbook and Excel VBA Worksheet object. You will see that the Worksheet and Workbook object have properties and methods as well, such as the count property which counts the number of active workbooks or worksheets. The Workbook and Worksheet object are commonly used in Excel VBA. They are very useful when your macro code has to be executed on different workbooks or worksheets.
- Application Object:
- The mother of all objects is Excel itself. We call it the Application object. The application object gives access to a lot of Excel related options.
Excel VBA programming<
This section is for Excel VBA users who want to get the most out of Excel Visual Basic. Excel VBA Programming is not difficult, but you do need to know the keywords used in Excel VBA.
- Excel VBA uses variables just like any other programming language. Learn how to declare and initialize an excel vba variable of type Integer, String, Double, Boolean and Date.
- Option Explicit:
- Using the Option Explicit statement at the start of your code forces you to declare all your variables. This avoids incorrectly typing the name of an existing variable.
- String Manipulation:
- There are many functions in Excel VBA we can use to manipulate strings. In this chapter you can find a review of the most important functions.
- Calculate with Excel VBA and add, subtract, multiply and divide values just like you are used to doing in Excel.
- If Then Statement:
- In many situations you only want Excel VBA to execute certain code lines when a specific condition is met. The If Then statement allows you to do this. Instead of multiple If Then statements, you can use Select Case.
- Instead of the more common Range object we could also use Cells. Using Cells is particularly useful when we want to loop through ranges.
- Looping is one of the most powerful programming techniques. A loop (or For Next loop) in Excel VBA enables you to loop through a range of data with just a few lines of code.
- Logical Operators:
- Do you want to execute code in Excel Visual Basic when more conditions are met? Or just one? Or none? Logical operators are what you need! Logical operators such as And, Or and Not are often used in Excel VBA.
- The Range object which is the representation of a cell (or cells) on your worksheet is the most important object of Excel VBA. It has many properties and methods and they are essential to manipulate the content of your Excel worksheet. In this chapter you will discover the most useful properties and methods of the Excel VBA Range object. They enable you to obtain control over your Excel worksheet.
- This chapter teaches you how to program workbook and worksheet Events. Events are actions performed by users which trigger Excel VBA to execute a macro. For example, when you open a workbook or when you change something on an Excel worksheet, Excel VBA can automatically execute a macro.
- An Excel VBA array is a group of variables. You can refer to a specific variable (element) of an array by using the array name and the index number. This chapter explains how to declare and initialize a one-dimensional and two-dimensional array and how to find the size of an array.
- Date and Time:
- Dates and Times in Excel VBA can be manipulated in many ways. Easy examples are given in this chapter.
- Function and Sub:
- The difference between a function and a sub in Excel VBA is that a function can return a value and a sub cannot. In this chapter we will look at an easy example of a function and a sub. Functions and subs become very useful as program size increases.
Excel VBA controls<
This section is about communicating with users using controls or a Userform. Learn how to use these controls in Excel 2010, Excel 2007 or Excel 2003. You can directly place controls on a sheet or place them on a Userform.
- A textbox is an empty field where the user can fill in a piece of text. Learn how to draw a textbox on your worksheet and how to refer to a textbox in your Excel VBA code.
- A listbox, is a drop down list from where the user can make a choice. Learn how to draw a listbox on your worksheet and how to add items to a listbox.
- A combobox is the same as a listbox but now the user can also fill in his/her own choice if it is not included in the list. Learn how to draw a combobox on your worksheet and how to add items to a combobox.
- A checkbox is a field which can be checked to store information. Learn how to draw a checkbox on your worksheet and how to refer to a checkbox in your Excel VBA code.
- Option Buttons:
- Option Buttons are the same as checkboxes except that option buttons are dependent on each other while checkboxes are not. This means that when you check one option button the other option button will automatically uncheck.
- This chapter teaches you how to create an Excel VBA Userform (also known as a dialog box). You can download the Userform on this page as well.
Are you looking for easy to follow Excel VBA programming examples? Are you looking for clear explanations that help you master many more advanced Excel VBA features? Then take the next step!
With step by step instructions, we will teach you how to write all sorts of Excel VBA programs yourself. We know through our years of expertise how important it is to have good examples. Good examples say more than a lengthy description of the theory. Start today, and become an Excel VBA professional quickly and easily.