VBA code to select all merged cells

VBA Code Snippets

Merged cells can be frustrating when using VBA code, as they just don’t operate in the same way as normal cells.  Even when using Excel without VBA, merged cells cause  a whole host of frustrating error messages. Even if you don’t use them, lots of other users do.  So you will encounter merged cells in … Read more

VBA code to contol Form Control checkboxes

VBA Code Snippets

Checkboxes are one of the easiest ways to create interaction with users.  Controlling them with VBA makes them more flexible and more useful in Excel applications. Here is a collection of the most common code snippets and settings. Create Check Boxes The following code will create a checkbox Sub CreateCheckBoxes() ‘Create variable Dim chkBox As … Read more

VBA: Convert centimeters, inches & pixels to points

VBA Code Snippets

It is frustrating that Excel, PowerPoint and Word work natively using a measurement known as points.  However, measurements within the standard application menus are set in centimeters or inches.  This can be seen when setting the position and size of a shape in PowerPoint through the standard menus. Yet, when using a macro to retrieve … Read more

VBA Code to Password Protect an Excel file

VBA Code Snippets

Password protecting an Excel file achieves two main objectives (1) prevents unauthorized access to the Excel file (2) prevents unauthorized modification of the Excel file. File-level protection is not the same as worksheet protection or workbook protection.  Worksheet protection controls what a user can or cannot do on a worksheet, such as inserting rows or … Read more