VBA & macros
Automate repeat work with macros and VBA code.
- VBA Code to Remove an Excel Workbook Password SafelyVBA can remove a password from Excel worksheet protection or workbook-structure protection when you already know the password; it cannot reveal or…
- VBA Excel Activate Range: Syntax and ExamplesIn Excel VBA, Range.Activate makes one cell the active cell; it does not make an entire multi-cell range active. To activate a…
- VBA Code in Excel to Send Email: A Practical GuideIn Excel for Microsoft 365 on Windows, VBA can create an email through classic Outlook desktop: open the VBA editor, add a…
- VBA Code for Sending Email From ExcelTo create an email from Excel VBA, automate classic Outlook for Windows: use CreateObject("Outlook.Application"), create a mail item, fill in its fields,…
- Unhide Worksheet in Excel VBA: Methods, Code, and FixesTo unhide a worksheet with VBA, set its Visible property to xlSheetVisible. You can reveal one named sheet or loop through every…
- Select to Bottom of Array in Excel VBA: Safe MethodsTo select from the active cell to the bottom of its contiguous data block in Excel VBA, use Range(ActiveCell, ActiveCell.End(xlDown)).Select—but only when…
- Reset Used Range in Excel VBA: Safe Steps and CodeTo reset an inflated used range in Excel VBA, delete the unused rows below and columns to the right of the sheet’s…
- Remove VBA From an Excel Workbook SafelyTo remove VBA from an Excel workbook, open it in the desktop version of Excel, choose File > Save As, and save…
- Remove Duplicates Excel VBA Code: Safe ExamplesTo remove duplicate rows with Excel VBA, select the full table, including its header row, then run a macro that calls Range.RemoveDuplicates.…
- Excel VBA UserForms: How They Work and When to Use ThemAn Excel VBA UserForm is a custom dialog window that lets people enter, review, or choose information without typing directly into worksheet…
- Excel VBA Loops: How to Repeat Tasks EfficientlyAn Excel VBA loop repeats a block of code until it has processed a set number of items or a condition is…
- Excel VBA Sort: How to Sort Data with a MacroTo sort a worksheet range with Excel VBA, define the full range, add one or more sort keys, set whether the range…
- Excel VBA InputBox: Collect Text, Numbers, and ChoicesIn Excel VBA, an InputBox displays a dialog that asks the user to enter information. Use VBA’s InputBox function for a simple…
- Excel VBA Arrays: How They Work and When to Use ThemAn Excel VBA array is a variable that holds multiple related values, such as a list of names or a block of…
- Excel Macro to Remove Duplicates: VBA GuideYes. In Excel for Microsoft 365 on Windows, a VBA macro can remove duplicates with the built-in Range.RemoveDuplicates method. Specify the full…
- Macro Recorder for Mac Excel: Setup, Steps, and LimitsYes. Excel for Microsoft 365 for Mac has a macro recorder: enable the Developer tab if it is hidden, choose Developer >…
- Excel Macro to Compare Two Excel Sheets Cell by CellTo compare two worksheets in Excel for Microsoft 365 on Windows, use a VBA macro that checks the calculated value in each…
- Excel Macro Not Responding? Fix It SafelyIf an Excel macro is not responding, first give it a little time if Excel is still using CPU or updating data;…
- Excel VBA Loops: How to Repeat Tasks Safely in a MacroA loop in an Excel VBA macro repeats a block of instructions for a set of cells, rows, objects, or until a…
- Excel VBA Format Worksheet: Examples and Key OptionsTo format a worksheet with Excel VBA, reference the worksheet and set properties such as Font, Interior, NumberFormat, alignment, or column width.…
- How to Write a For Loop in Excel VBA, With ExamplesTo write a For loop in Excel VBA, open the Visual Basic Editor, insert a module, and place the work you want…
- How to Record a Macro in ExcelTo record a macro in Excel for Microsoft 365 on Windows, open the Developer tab, choose Record Macro, perform the actions you…
- How to Use a ComboBox in an Excel VBA UserFormTo use a ComboBox in an Excel VBA UserForm, add the control in the Visual Basic Editor, fill it with choices when…
- Rename a UserForm in Excel VBA Without Breaking ReferencesTo rename a UserForm in Excel VBA, open the Visual Basic Editor, select the form in Project Explorer, press F4, and change…
- How to Change a UserForm Name in Excel VBA Without ErrorsTo change a UserForm’s internal name in Excel for Microsoft 365 on Windows, open the Visual Basic Editor, select the form in…
- Add a Calendar to an Excel VBA UserFormTo add a calendar to an Excel VBA UserForm, create a small date-picker form with standard Microsoft Forms buttons and labels, then…
- Hide Rows in Excel for a Specific Range With VBATo hide a specific block of worksheet rows in Excel for Microsoft 365 on Windows, use VBA to set those rows’ Hidden…
- Excel VBA MsgBox Carriage Return: Line Breaks ExplainedTo put a carriage return and line break in an Excel VBA MsgBox, join the message parts with vbCrLf, as in MsgBox…
- Excel VBA MsgBox Custom Buttons and ChoicesExcel VBA’s built-in MsgBox cannot create arbitrary button captions such as “Continue” or “Skip”; it offers fixed button sets such as Yes/No…
- Excel VBA: Move a Worksheet to the EndTo move a worksheet to the last tab in its workbook with VBA, use Worksheet.Move and set its After argument to the…