VBA & macros
Automate repeat work with macros and VBA code.
- Excel UserForm TextBox: How to Wrap TextTo wrap text in an Excel UserForm TextBox, set its MultiLine property to True and its WordWrap property to True. In the…
- Excel UserForm Toolbox: What It Is and How to Use ItThe Excel UserForm Toolbox is the panel in the Visual Basic Editor (VBE) that lets you add controls—such as text boxes, labels,…
- Excel UserForm Scrollbar: Setup, VBA, and TroubleshootingTo add a scrollbar to an Excel UserForm, set the form’s ScrollBars property to vertical, horizontal, or both, then make ScrollHeight or…
- Excel UserForm: How to Show It with VBATo show an Excel UserForm, create the form in the Visual Basic Editor, then run a VBA procedure that calls its Show…
- Excel UserForm TextBox Date Format: dd/mm/yyyyTo display a date as dd/mm/yyyy in an Excel VBA UserForm TextBox, validate the text and format it in the TextBox’s Exit…
- PowerPoint VBA: How to Loop Through SlidesTo loop through every slide in the open PowerPoint presentation, use a VBA For Each loop over ActivePresentation.Slides. For example, the macro…
- Print a VBA Dictionary: Immediate Window and WorksheetTo print a VBA dictionary for debugging, loop through its keys and items and send each pair to the Immediate window with…
- Excel VBA Range Hyperlinks: Insert, Edit, and RemoveTo insert a hyperlink into an Excel range with VBA, use the worksheet’s Hyperlinks.Add method and set its Anchor to the cell…
- Pivot Table Refresh From VBA: Code and Common FixesTo refresh a PivotTable with VBA in Excel for Microsoft 365 on Windows, call its RefreshTable method, such as Worksheets("Summary").PivotTables("ptSales").RefreshTable. To refresh…
- PowerPoint VBA InputBox Location and How to Position ItIn PowerPoint VBA, call the built-in InputBox function from a macro; its optional XPos and YPos arguments set the dialog’s position on…
- Pivot Table VBA: Create, Refresh, and Update Excel ReportsIn Excel VBA, a PivotTable is controlled through objects such as PivotTable, PivotCache, and PivotField. A macro can create a PivotTable from…
- MS Access VBA: How to Send Email SafelyYes. Microsoft Access VBA can send email with DoCmd.SendObject for an Access report or other database object, or automate classic Outlook when…
- MS Access VBA: Send Email With an Attachment SafelyYes. In Microsoft Access for Windows, VBA can create an email in classic Outlook, add a file with the Outlook Attachments.Add method,…
- Pivot Table Not Refreshing Through VBA? Causes and FixesIf an Excel PivotTable does not update through VBA, first confirm that its source includes the changed rows, then refresh the correct…
- Excel UserForm Label: Setup, Properties, and VBA ExamplesAn Excel UserForm label is a control that displays text on a VBA form, such as an instruction, field name, or status…
- Excel UserForm Layout: Design, Controls, and Setup TipsAn Excel UserForm layout is the arrangement of the form window and its controls—such as text boxes, labels, buttons, and lists—used to…
- Excel UserForm Option Button: Setup and VBA GuideAn Excel UserForm option button (also called a radio button) lets a user choose one item from a group of alternatives. In…
- Named Range in VBA: Create, Read, and Manage Excel NamesIn Excel VBA, a named range is a defined name that refers to a cell, a range of cells, or sometimes a…
- VBA MsgBox Multiple Buttons: Options and ExamplesYes. In VBA, use the buttons argument of MsgBox to show a built-in group such as Yes/No or Yes/No/Cancel, then check the…
- VBA MsgBox Command: Syntax, Buttons, and Examples in ExcelIn VBA, MsgBox displays a message in a dialog box and can return a value indicating which button the user clicked. In…
- VBA MsgBox Function: Syntax, Buttons, and ExamplesIn VBA, MsgBox displays a dialog box with a message and optional buttons, title, and icon. It also returns a value identifying…
- MS Access VBA Dictionary: Setup, Examples, and TipsYes. Microsoft Access VBA can use the Scripting.Dictionary object to store key-value pairs, look up a value by its key, and check…
- MS Access VBA For Loop: Syntax, Examples, and TipsYes. In Microsoft Access VBA, a For...Next loop repeats a block of code for a counter running through a specified range; use…
- Access VBA MsgBox: Syntax, Buttons, and ExamplesIn Microsoft Access VBA, use MsgBox to display a message or ask a user a simple question; its optional button settings control…
- Loop Through a Named Range in VBA: Practical ExamplesTo loop through every cell in an Excel named range in VBA, assign the range to a Range variable and use For…
- VBA Lowercase Strings: Using LCase and Common FixesTo convert text to lowercase in VBA, use the built-in LCase function: for example, lowerText = LCase(originalText). It returns a lowercase version…
- Make a Plot with a Dictionary in VBA: Excel GuideYes. In Excel for Microsoft 365 on Windows, use a VBA Scripting.Dictionary to group records by category, write the resulting category-and-total table…
- Excel UserForm Events: What Fires, When, and Why in VBAExcel UserForm events are VBA procedures that run in response to a form’s life cycle or to actions on the form and…
- Excel UserForm Initialize: How It Works and How to Use ItIn Excel VBA, UserForm_Initialize is the event procedure that runs when a UserForm instance is loaded, before the form is displayed. Put…
- Excel UserForm Images: Add, Size, and Fix Picture IssuesTo add an image to an Excel VBA UserForm, open the form in the Visual Basic Editor, place an Image control from…