VBA & macros
Automate repeat work with macros and VBA code.
- Excel VBA Loop Collection: For Each and ExamplesTo loop through a VBA Collection in Excel, use For Each to visit every item, or use a numbered For loop when…
- Excel VBA: Loop Through JSON Object Arrays Step by StepTo loop through a JSON array of objects in Excel VBA, parse the JSON with a VBA-compatible parser such as VBA-JSON, then…
- Excel VBA: Load a CSV File Into a Worksheet SafelyTo load a CSV file into an Excel worksheet with VBA, use Workbooks.OpenText to parse the file, then copy its cells into…
- Excel VBA Link to a Range: Methods, Examples, and UsesTo create an internal hyperlink to a cell or range with Excel VBA, use the destination in the hyperlink’s SubAddress argument and…
- Excel VBA Link to Worksheet: Methods and ExamplesIn Excel VBA, link to a worksheet by referring to it with ThisWorkbook.Worksheets("SheetName"); to create a clickable link that takes a user…
- Excel VBA Join Function: Syntax, Examples, and TipsIn Excel VBA, Join combines the items in a one-dimensional array into one string, placing a chosen delimiter between them. Its syntax…
- Excel VBA LAMBDA: Calling Worksheet Functions from VBAExcel’s LAMBDA function is a worksheet feature, not a VBA language feature: VBA has no built-in anonymous-lambda syntax. You can define a…
- Excel VBA Left Function: Syntax, Examples, and TipsIn Excel VBA, Left returns a specified number of characters from the start of a string: for example, Left("Invoice-8472", 7) returns Invoice.…
- Excel VBA Join Array: Syntax, Examples, and Common FixesIn Excel VBA, use Join(array, delimiter) to combine the elements of a one-dimensional array into a single string. For example, Join(Array("red", "green",…
- Excel VBA Intersect Function: How It WorksIn Excel VBA, Application.Intersect returns the cells shared by two or more ranges on the same worksheet. If the ranges do not…
- Excel VBA Jagged Arrays: How to Create and Use ThemExcel VBA does not have a dedicated jagged-array type, but you can make a jagged array by storing separate arrays inside the…
- Excel VBA InputBox Validation: A Practical GuideTo validate an Excel VBA input, use Application.InputBox to collect a value, check it against your rules in a loop, and repeat…
- Excel VBA Insert Row: Examples and Safe MethodsTo insert a worksheet row with Excel VBA, use Rows(5).Insert Shift:=xlDown; this inserts a blank row above row 5. Qualify Rows with…
- Excel VBA Int Function: What It Does and How to Use ItIn Excel VBA, Int(number) returns the greatest whole-number value less than or equal to the number: for example, Int(7.9) is 7, while…
- Excel VBA InputBox Type: Values, Examples, and UseIn Excel VBA, the Type argument belongs to Application.InputBox and controls what kind of response the dialog accepts: text, a number, a…
- Excel VBA InputBox Range Selection: How to Use Type 8To let someone select cells in Excel VBA, use Application.InputBox with Type:=8; it returns the selection as a Range object. Assign that…
- Excel VBA InputBox String: Return Values and Type HandlingIn Excel VBA, the built-in InputBox function returns the user’s response as a String. One important catch is that clicking Cancel also…
- Excel VBA InputBox Syntax: Arguments and ExamplesIn Excel VBA, the basic syntax is InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context]). It displays a dialog…
- Excel VBA InputBox Password: Masking and Secure OptionsExcel’s built-in VBA InputBox cannot hide a password as the user types; it displays the entered characters. To show dots or asterisks,…
- Excel VBA InputBox Multiple Inputs: Practical MethodsExcel VBA’s standard InputBox collects one response at a time; it does not provide several separate fields in one dialog. To collect…
- Excel VBA InputBox and IME: How Text Entry Works in WindowsExcel VBA’s built-in InputBox accepts text entered with a Windows IME (Input Method Editor), such as Japanese, Chinese, or Korean text. It…
- Excel VBA InputBox and MsgBox: How They Work TogetherIn Excel VBA, InputBox asks a user for a value, while MsgBox displays information or asks the user to choose an action.…
- Excel VBA InputBox Function: Syntax and ExamplesThe Excel VBA InputBox function displays a dialog that asks a user for a response and returns that response as a string.…
- Excel VBA InputBox Integer: Get and Validate Whole NumbersYes—VBA can ask for an integer with an input box, but neither common input-box option automatically guarantees a whole number. For reliable…
- Excel VBA InputBox for Dates: How to Validate InputTo ask for a date in Excel VBA, collect the entry as text, validate it, and convert it to a VBA Date…
- Excel VBA InputBox Choices: Menus, Buttons, and FormsExcel VBA’s standard InputBox asks users to type a response; it does not create a dropdown or a set of selectable choices.…
- Excel VBA InputBox Cancel: Exit a Sub SafelyYes. To stop the current Excel VBA procedure when a user cancels an input box, test the returned value and use Exit…
- Excel VBA: Initialize Arrays, Set Values, and Resize ThemTo initialize an array in Excel VBA, declare it and assign values: use Dim items As Variant: items = Array("red", "green", "blue")…
- Excel VBA Input Form: How to Build and Use a UserFormAn Excel VBA input form is a custom window, usually built as a VBA UserForm, that lets people enter information without typing…
- Excel VBA InputBox Cancel: How to Detect ItIn Excel VBA, the built-in InputBox function returns an empty string when the user clicks Cancel, just as it does when the…