Skip to content
- Excel VBA Range of Object Failed? Common Causes and FixesThe Excel VBA error “Method ‘Range’ of object ‘_Worksheet’ failed” usually means VBA could not resolve the address you gave to a…VBA & macros
- Excel VBA MATCH Error Handling: Avoid Run-Time ErrorsFor safer Excel VBA MATCH error handling, use Application.Match and test its result with IsError before using it. Unlike Application.WorksheetFunction.Match, which raises…VBA & macros
- Excel VBA Macro to Send a Worksheet File via TeamsYes—but Excel VBA has no built-in command that sends a worksheet directly to Microsoft Teams. A practical Windows method is to export…VBA & macros
- Excel VBA: Loop Through All Open Workbooks in a MacroTo loop through every workbook currently open in desktop Excel, use a For Each loop over Application.Workbooks. Declare a Workbook variable, then…VBA & macros
- Excel VBA Long Strings: Limits and Practical FixesIn Excel VBA, use a variable-length String to hold long text; it can theoretically contain about 2 billion characters, although available memory…VBA & macros
- Excel VBA List Worksheet Names: Methods and ExamplesTo list worksheet names with Excel VBA, loop through the workbook’s Worksheets collection and read each sheet’s Name property. You can print…VBA & macros
- Excel VBA: List All Sheets in a WorkbookTo list every sheet in the workbook that contains your VBA code, loop through its Sheets collection and print each name in…VBA & macros
- Excel VBA: Keep a UserForm on TopTo keep an Excel VBA UserForm above other windows on Windows, call the Windows API function SetWindowPos with the HWND_TOPMOST option when…VBA & macros
- Excel VBA: Insert a Row and Shift Cells DownTo insert a worksheet row in Excel VBA and push the existing rows down, use Rows(rowNumber).Insert Shift:=xlShiftDown on the worksheet you want…VBA & macros
- Excel VBA Insert Row Below Active Cell: Code and TipsTo insert a complete worksheet row immediately below the active cell in Excel for Microsoft 365 on Windows, run a VBA macro…VBA & macros
- Excel VBA: Insert the Current Date and Time in a CellTo insert a fixed date-and-time timestamp with Excel VBA, assign the VBA function Now to a cell, then apply a number format.…VBA & macros
- Excel VBA InputBox Dropdown List: What Works InsteadNo: Excel VBA’s standard InputBox cannot display a dropdown list of choices. To offer a real dropdown, use a VBA UserForm with…VBA & macros
- Excel VBA InputBox With Multiple InputsExcel VBA’s built-in InputBox and Application.InputBox each display one input field, not a form with several fields. To collect multiple values, show…VBA & macros
- Excel VBA Input Box With a Drop-Down ListExcel’s built-in VBA InputBox cannot display a drop-down list. To let someone choose from fixed options, create a VBA UserForm with a…VBA & macros
- Excel VBA InputBox Types and When to Use EachExcel VBA has two commonly used input boxes: the VBA InputBox function, which returns text, and Application.InputBox, which can require a particular…VBA & macros
- Excel VBA Input Box to Select a Row by NumberTo select a worksheet row by its number, use VBA’s Application.InputBox with Type:=1, validate the entered number, then select ws.Rows(rowNumber). If you…VBA & macros
- Excel VBA Input Box Dropdown List: Options and SetupExcel’s built-in VBA InputBox does not support a dropdown list. To let someone choose from a visible list, create a VBA UserForm…VBA & macros
- Excel VBA Input Box Date Picker: What Actually WorksExcel’s VBA InputBox does not include a calendar or date-picker control: it asks the user to type a response. For Microsoft 365…VBA & macros
- Excel VBA: How to Stop an Infinite Loop Safely in ExcelTo stop a running Excel VBA macro, press Ctrl+Break on Windows, then choose End to stop it or Debug to inspect the…VBA & macros
- Excel VBA: Hide a Column by Number in Your WorksheetTo hide a column by its number in Excel VBA, set that worksheet column’s Hidden property to True. For example, ws.Columns(3).Hidden =…VBA & macros
- Excel VBA: Get the Number of Sheets in a Workbook EasilyTo get the number of sheets in a workbook with VBA, use the workbook’s Sheets.Count property—for example, ThisWorkbook.Sheets.Count. Use Worksheets.Count instead if…VBA & macros
- Excel VBA: Get the Last Day of a MonthIn Excel VBA, use DateSerial(Year(d), Month(d) + 1, 0) to get the final date of the month containing a date. The zero…VBA & macros
- Excel VBA Get Array Dimensions: Bounds, Rank, and SizeIn Excel VBA, use LBound(array, dimension) and UBound(array, dimension) to get an array’s lower and upper bounds; its element count in a…VBA & macros
- Excel VBA Get Current Workbook Name: Code and TipsTo get the name of the workbook currently active in Excel VBA, use ActiveWorkbook.Name. For example, assign Set wb = Application.ActiveWorkbook and…VBA & macros
- Excel VBA: Get the Current Workbook File Path EasilyIn Excel VBA, use ThisWorkbook.Path to get the folder path of the workbook that contains the code, or ActiveWorkbook.Path to get the…VBA & macros
- Excel VBA Gantt Chart: Build and Automate a TimelineYes. You can use VBA to build a Gantt-style schedule in Excel by turning task start dates and durations into a calendar…VBA & macros
- Excel VBA Function Tutorial: Write and Use FunctionsAn Excel VBA function is a procedure that calculates a value and returns it to the code that called it; you can…VBA & macros
- Excel VBA Function Name Error: Common Causes and FixesAn Excel VBA function-name error usually means VBA cannot parse or find the procedure name, or Excel cannot recognize a custom function…VBA & macros
- Excel VBA Function Examples: Useful Worksheet UDFsExcel VBA function examples show how to create custom worksheet functions for tasks that built-in formulas do not handle conveniently. Add a…VBA & macros
- Excel VBA Freeze Worksheet: Freeze Panes or Lock CellsIn Excel VBA, use ActiveWindow.FreezePanes to keep rows or columns visible while you scroll; use worksheet protection when you mean to stop…VBA & macros