Each VBA Tutorial contains macro examples to help you learn VBA code quickly. Follow these VBA tutorials to learn basic and advanced Excel macro programming.
Use VBA to find out who has your Excel file locked for editing. Save this macro to your spreadsheet and it will tell you when someone else has the file open.
In VBA, you can stop your macro execution manually with the Esc key or by pressing Ctrl+Break. Remember this the next time you need to exit an infinite loop.
We've combined each of our comprehensive wellsrPRO VBA training reference guides into a single bundle with over 200 tips and macros covering the 125 most important topics in VBA.
Use the VBA Application.Wait method to pause your macro for a specific amount of time. Application.Wait lets you delay your macro by a fixed number of seconds.
The VBA Mod operator is the VBA equivalent of the Excel MOD function. You use the VBA modulo operator to return the remainder after dividing two numbers.
We just added a 6th cheat sheet to our training bundle. With our new guide on VBA UserForms, our bundle now has over 200 tips like how to automate data extraction from text files, how to remove duplicates from an array, and how to dynamically populate a listbox.
Change negative numbers to positive numbers and positive numbers to negative numbers in Excel by using VBA. These macros reverse the sign of cells in Excel.
Use the VBA Sleep function to add a macro time delay. The Sleep function is better than Application.Wait because it lets you pause macros for milliseconds.
The VBA Err.Raise method can be used to raise custom errors. Pair it with the vbObjectError constant to avoid conflicts with reserved system error numbers.
Change your VBA MsgBox text color by using the SetSysColors user32 API function. This macro example makes changing your MsgBox text color extremely easy.