VBA & macros
Automate repeat work with macros and VBA code.
- Excel Sheet Open VBA: Open and Activate a WorksheetTo open a worksheet that is already in an Excel workbook, use VBA to activate it: ThisWorkbook.Worksheets("Summary").Activate. If you mean opening a…
- Excel Range Find VBA: Search Cells ReliablyIn Excel VBA, use the Range.Find method to search a specified range; check whether it returned a cell before using the result.…
- Excel Not Responding After a Macro? What to DoIf Excel says “Not Responding” after you run a macro, first give it a moment and check whether it is still working;…
- VBA Error Handling for Multiple Errors in One MacroVBA handles runtime errors one at a time: use On Error GoTo to route an unexpected failure to a handler, or use…
- Excel VBA UserForm Examples: Forms, Code, and Setup GuideCommon Excel VBA UserForm examples include a contact-entry form, a search box, a data-editing dialog, and a task-specific menu. A UserForm is…
- Easy Macro Recorder in Excel: How to Record and Use OneYes. Microsoft Excel for Microsoft 365 includes a built-in macro recorder: choose Developer > Record Macro, perform the steps you want to…
- Dynamic Pivot Table VBA: Fixing Common Code FailuresYes—dynamic PivotTable VBA can fail, but the cause is usually a mismatch between the source data, the PivotCache, the field names, or…
- Delete a Specific Row With a VBA MacroYes. In Excel for Microsoft 365 on Windows, a VBA macro can delete a specific worksheet row with Rows(rowNumber).Delete; set the worksheet…
- Delete the Last Row in Excel VBA SafelyTo delete the last data row of an Excel table, use the table’s ListRows collection: tbl.ListRows(tbl.ListRows.Count).Delete. For a worksheet row, first identify…
- Delete Rows From an Input Range in VBATo delete worksheet rows covered by a range you select in Excel VBA, use Application.InputBox with Type:=8, then delete the corresponding rows…
- Delete Table Row in VBA: Excel Examples and TipsTo delete a row from an Excel table with VBA, use the table’s ListRows collection: identify the table with ListObjects, then call…
- Delete Entire Row VBA: Examples and Safety TipsTo delete a complete worksheet row with VBA, use Rows(rowNumber).Delete on a specifically named worksheet, such as Worksheets("Data").Rows(5).Delete. This removes row 5…
- Delete Blank Rows in Excel VBA Safely and CorrectlyTo delete completely blank rows with VBA in Excel for Microsoft 365 on Windows, run a macro that checks each row from…
- Copy-Paste VBA Code: Add, Run, and Troubleshoot ItTo copy and paste VBA code into Excel for Microsoft 365 on Windows, press Alt+F11 to open the Visual Basic Editor, choose…
- Copy Paste Values in Excel VBA: Methods and ExamplesTo copy a range’s results—not its formulas—in Excel VBA, use Copy followed by PasteSpecial Paste:=xlPasteValues. For a quick copy between equally sized…
- Copy and Paste Values in VBA: Methods and ExamplesTo copy only cell values with Excel VBA, assign one range’s Value2 to another range of the same size, such as destinationRange.Value2…
- Copy and Paste a Range in Excel VBA: Methods and ExamplesIn Excel VBA, copy a range with the Range.Copy method and its Destination argument; for example, identify a source range and a…
- Quick Sort in VBA: Built-In Function or Custom Code?No: VBA does not include a built-in procedure or keyword named QuickSort or quick sort. Call is a real VBA statement, but…
- Active Range in VBA: What It Means and How to Use ItIn Excel VBA, “active range” usually means the cell or cells currently selected, but ActiveRange is not a built-in Excel VBA property.…
- Access VBA Find Text: Methods, Examples, and FixesTo find text in Access VBA, use a DAO recordset’s FindFirst method with a criterion such as [LastName] = 'Garcia'. On a…
- Access VBA Function Examples for Forms, Queries, and TablesAccess VBA functions are reusable procedures that return a value, such as a formatted name, a calculated amount, or a date check.…
- Access VBA String to Number: Safe Conversion GuideIn Access VBA, convert a numeric string with the function that matches the number you need: use CLng for a whole-number Long,…
- Access VBA Find in String: InStr, Options, and ExamplesIn Access VBA, use InStr to find one string inside another: it returns the 1-based position of the first match, or 0…
- Access VBA Error Handling: Trapping and Fixing ErrorsAccess VBA error handling lets a procedure respond when a runtime error occurs instead of stopping unexpectedly. Use On Error GoTo HandlerLabel…
- Access VBA: Find a Character in a StringIn Access VBA, use InStr to find a character or substring: it returns the character’s 1-based position, or 0 when no match…
- Access VBA Date Conversion: Parse, Format, and ValidateIn Access VBA, use CDate to convert a value VBA already recognizes as a date, DateSerial to build a date from year,…
- Access VBA: How to Delete Table Rows Safely and CorrectlyIn Access VBA, a “row” is usually a record in a table. To delete matching records, run a DELETE query with a…
- Text Macro Examples for Excel: Practical VBA TasksText macro examples for Excel include cleaning extra spaces, changing text to uppercase, adding a prefix, and replacing one word with another.…
- VBA Outlook: How to Create a Contact GroupIn classic Outlook for Windows, VBA can create a contact group by making an Outlook DistListItem, adding resolved recipients with AddMembers, and…
- Excel VBA Frame With Scroll Bar: Setup and CodeTo make a scrollable area in Excel VBA, add a Frame to a UserForm, set its ScrollBars property to fmScrollBarsVertical or fmScrollBarsBoth,…