VBA & macros
Automate repeat work with macros and VBA code.
- Sort Using VBA in Excel: Code Examples, Options, and TipsYes. In Excel for Microsoft 365 on Windows, you can sort data with VBA by defining the full range, specifying a sort…
- Sort Columns in Excel with VBAYes. In Excel VBA, use the Sort object to sort entire rows by values in a chosen column, or set its orientation…
- Simple Macro Recorder and Auto Clicker: How They WorkA simple macro recorder captures a sequence of actions—such as clicks, keystrokes, and pauses—and plays them back; an auto clicker repeats mouse…
- Send Email from MS Access Using VBAYes. In Microsoft Access for Windows, VBA can create and send an email through classic Outlook automation, or open a message using…
- Screen Macro Recorder: How It Works and What to ChooseA screen macro recorder is a tool that records actions you perform on a computer—such as clicks, keystrokes, and window changes—and replays…
- Active Worksheet in VBA: How to Reference ItIn Excel VBA, use the ActiveSheet object to refer to the tab that is active at that moment. Assign it to a…
- Refresh Pivot Table Using VBA: Code and TipsTo refresh a PivotTable with VBA in Excel for Microsoft 365 on Windows, call its RefreshTable method; to refresh every PivotTable in…
- Range vs Cell in VBA: Differences, Syntax, and ExamplesIn Excel VBA, a cell is represented by a Range object: use Range to refer to an address or block such as…
- VBA Range in Excel: How to Reference CellsIn Excel VBA, a Range is an object that represents one cell or a group of cells. To refer to a cell,…
- Pivot Table Styles VBA: Apply, Change, and TroubleshootIn Excel VBA, set a PivotTable’s TableStyle2 property to a built-in style name, such as PivotStyleMedium9, to apply a style. For example:…
- Optimize Copy Paste VBA for Faster Excel WorkbooksTo optimize copy-and-paste in Excel VBA, avoid selecting cells and using the clipboard when you only need to transfer cell values: assign…
- Outlook VBA: Select an Excel Worksheet by PathIn Outlook VBA on Windows, create an Excel application object, open the workbook by its full file path, then activate the worksheet…
- Open Workbook VBA: Excel Methods and ExamplesTo open an Excel workbook with VBA, call Workbooks.Open and provide its full file path. For example, assign the result to a…
- Optimize Copy-Paste Formulas in VBATo optimize formula copying in Excel VBA, assign a formula to an entire destination range at once instead of copying cells in…
- VBA Error Handler: How On Error Works and When to Use ItIn VBA, an error handler is code that responds when a statement fails while a procedure is running. You create one with…
- MS Project VBA: How to Find the Windows OS VersionIn Microsoft Project for Windows, use Windows Management Instrumentation (WMI) from VBA to read the operating system’s name, version, and build. The…
- Excel VBA: Find the Last Row With Data in a ColumnIn Excel VBA, the usual way to find the last occupied row in one column is to start at the bottom of…
- Excel VBA Error Handling: On Error, Err, and RecoveryIn Excel VBA, handle runtime errors with On Error GoTo HandlerLabel, inspect the failure through the Err object, and use a cleanup…
- MS Access VBA MsgBox Examples: Syntax, Buttons and UseIn Microsoft Access VBA, use MsgBox to show a message or ask a user a question; combine button and icon constants with…
- MS Access VBA Error Handling: Guide, Patterns, and TipsIn Microsoft Access VBA, handle runtime errors with an On Error statement: use On Error GoTo HandlerLabel for procedures that need to…
- Microsoft VBA Can’t Find Project or Library?“Can’t find project or library” is usually a VBA compile error caused by a missing, broken, or incompatible reference in the workbook…
- Microsoft VBA for Excel: What It Is and How It WorksMicrosoft VBA for Excel is the programming language built into desktop Excel for automating repetitive tasks, creating custom procedures, and interacting with…
- Microsoft Excel VBA: What It Is and How to Use ItMicrosoft Excel VBA is the programming language built into the desktop versions of Excel that lets you automate tasks, create custom procedures,…
- Microsoft Office Macro Recorder: How It WorksMicrosoft Office has macro recorders in desktop Excel and Word; in Excel for Microsoft 365 on Windows, choose View > Macros >…
- Excel VBA Visible Worksheet Property: How to Set ItIn Excel VBA, a worksheet’s visibility is controlled by its Visible property. Set it to xlSheetVisible to show a worksheet, xlSheetHidden to…
- Microsoft Excel VBA InputBox: How to Use It SafelyIn Excel VBA, use InputBox to ask a person for a text response, or use Application.InputBox when you need Excel to validate…
- Microsoft Excel VBA Range: Working With Cells and RangesIn Excel VBA, a Range is an object that represents one cell, a rectangular block of cells, or—in some cases—multiple separate areas.…
- Microsoft Excel VBA Dictionary: How to Use ItA Microsoft Excel VBA Dictionary is a key-and-value collection that lets a macro look up, count, and update information by a unique…
- Microsoft Excel VBA For Loops: Syntax and ExamplesIn Microsoft Excel VBA, a For...Next loop repeats instructions a set number of times, while For Each...Next repeats them for every item…
- Microsoft Excel Record Macro: Steps, Uses, and LimitsTo record a macro in Microsoft Excel for Microsoft 365 on Windows, select Developer > Code > Record Macro, perform the actions…