|

How to Make Your Own Excel Dialog Box with a Visual Basic UserForm

The built-in dialog boxes, MsgBox and InputBox$, are very useful for getting input from the user.  But sooner or later you will want to go further.  You might, while running code, want the user to make a choice from a list, or between several options.  For this, you want a UserForm.  For example: The program…

|

Other ActiveX Controls in Excel Worksheets

In an earlier post, we looked at connecting VBA code to command buttons on the Worksheet, the Quick Access Toolbar and the Ribbon.  What about the other ActiveX Controls: The Combo Box, List Box, or Check Box?  How about Option Buttons, the Scroll Bar, Spin button, Toggle button, etc.?  That’s coming up in this post….

Examples of Visual Basic Code for Controlling Excel

A major reason to program Excel Macros is to get the spreadsheet to do something.  This post is a goldmine of useful Excel Visual Basic code for talking to Excel.  You can get use the routines stand-alone.  Alternatively, you can save retyping or copy-pasting: Get the file Macros.xlsm free of charge from us. 1.        Table…

|

How to Use Objects, Collections, Properties, Events and Methods in Excel Visual Basic

1.        What are Objects and Collections? Visual Basic defines a number of what it calls Objects. Examples of Objects are: In object-orientated terminology, Objects belong to Classes. Collections are groups of Objects. Here are some examples of Collections that Visual Basic defines: 2.        The Excel Object Model Excel, too, has objects of its own.  When…

| |

Built-in Functions in Excel Visual Basic for Applications (VBA)

Before Excel 2003, you could get a complete list of Visual Basic Functions by looking in Visual Basic Help > Contents > Functions. In Excel 2010, entering “Functions” into the Help Search box produces nothing useful.  Using a specific category, e.g. “Math Functions”, may be more productive.  Please be aware of what references to “Excel…

More Excel Visual Basic Programming Basics

In this post, we will give you some more of the basic (forgive the pun) building blocks of the Visual Basic programming language. We will cover formulas, assigning values, logical comparison, constants, comments, and continuation lines. We conclude with two small examples. One of them demonstrates our first Error Trap. 1.     Formulas We have already…