Skip to content
- Excel VBA: Hide a Column RangeTo hide a range of columns with Excel VBA, set its Hidden property to True: use Columns("B:D").Hidden = True to hide columns…VBA & macros
- Excel VBA: Hide a Column Based on a Cell ValueYes. In Excel for Microsoft 365 on Windows, VBA can set a column’s Hidden property according to the value in a cell.…VBA & macros
- Excel VBA Hex String: Convert Numbers to HexadecimalIn Excel VBA, use the Hex function to turn a number into a hexadecimal string: Hex(255) returns FF. The result has no…VBA & macros
- Excel VBA Hidden Worksheets: Hide and Unhide SheetsIn Excel VBA, hide a worksheet by setting its Visible property to xlSheetHidden or xlSheetVeryHidden; set it to xlSheetVisible to show it…VBA & macros
- Excel VBA Hex Function: Convert Numbers to HexIn Excel VBA, Hex(number) converts a numeric value to a hexadecimal text string: for example, Hex(255) returns FF. It does not add…VBA & macros
- Excel VBA Hard-Coded Arrays: Syntax, Types, and ExamplesYes. In Excel VBA, you can hard-code a list of values with the Array function and assign it to a Variant, such…VBA & macros
- Excel VBA GoTo: How Labels and Errors WorkIn Excel VBA, GoTo is a statement—not a function—that transfers execution to a labeled line in the same procedure. It is also…VBA & macros
- Excel VBA Global Functions: Scope and How to Create OneIn Excel VBA, a global function is usually a Public Function declared in a standard module, making it callable from other modules…VBA & macros
- Excel VBA Global Array Example: Scope, Setup, and UseIn Excel VBA, declare a shared array with a Public statement at the top of a standard module, outside any procedure. For…VBA & macros
- Excel VBA Get Year From Date: Code, Dates, and ErrorsTo get the year from a date in Excel VBA, use the built-in Year function: Year(dateValue). For example, Year(Worksheets("Sheet1").Range("A2").Value) returns the year…VBA & macros
- Excel VBA Get Worksheet by Name: Examples and ErrorsIn Excel VBA, get a worksheet by name with Set ws = ThisWorkbook.Worksheets("Summary"), replacing Summary with the tab name. Use ThisWorkbook when…VBA & macros
- Excel VBA Get Workbook Name: Methods and ExamplesIn Excel VBA, use ThisWorkbook.Name to get the name of the workbook that contains the running code, or ActiveWorkbook.Name to get the…VBA & macros
- Excel VBA Get Worksheet Index: Methods and ExamplesIn Excel VBA, read a worksheet’s Index property to get its position in the workbook’s sheet-tab order: for example, ThisWorkbook.Worksheets("Data").Index. The number…VBA & macros
- Excel VBA: Get a Value From a UserForm TextBoxIn Excel VBA, read a UserForm TextBox with its Value property: for example, userName = Me.txtName.Value inside the form, or userName =…VBA & macros
- Excel VBA: Get a String from a Cell, Safely and ReliablyTo get a cell’s value as a VBA string, read it into a Variant and convert it with CStr: use Value2 for…VBA & macros
- Excel VBA: Get a PivotTable NameIn Excel VBA, get a PivotTable’s name from its Name property: pt.Name. First obtain the PivotTable object from a worksheet’s PivotTables collection,…VBA & macros
- Excel VBA: Get a Named Range’s ValueTo read a workbook-level named range in Excel VBA, get its Range object and read its Value or Value2 property: Set target…VBA & macros
- Excel VBA Get Month From Date: Code, Formats, and TipsIn Excel VBA, use the built-in Month function to get the month number from a date: Month(dateValue) returns a number from 1…VBA & macros
- Excel VBA: Get a PivotTable’s LocationTo get a PivotTable’s location in Excel VBA, use its TableRange2 property and read the range’s address. For example, pt.TableRange2.Address(External:=True) returns the…VBA & macros
- Excel VBA: Get the First Item in a DictionaryTo get the first key from a VBA Scripting.Dictionary, copy its keys into a Variant array and read the first array element:…VBA & macros
- Excel VBA: Get the Date to the Right of a StringIf a cell contains a text label and the date is in the cell immediately to its right, use VBA’s Find method…VBA & macros
- Excel VBA: Get a Range’s Length in Cells or CharactersIn Excel VBA, use Range.CountLarge to get how many cells a range contains; use Range.Rows.Count and Range.Columns.Count for its dimensions. If by…VBA & macros
- Excel VBA Get a Character from a String by PositionTo get one character from a string in Excel VBA, use Mid$(text, position, 1); the position starts at 1, not 0. For…VBA & macros
- Excel VBA Functions: How They Work and When to Use ThemExcel VBA functions are procedures that perform a calculation or task and return a result; you can write your own functions or…VBA & macros
- Excel VBA Functions With Multiple Parameters ExplainedTo create an Excel VBA function with multiple parameters, declare each argument in the function’s parentheses, separated by commas, then call the…VBA & macros
- Excel VBA Function Syntax: Examples and RulesExcel VBA function syntax starts with a Function statement and ends with End Function; the function returns a value by assigning it…VBA & macros
- Excel VBA Function Parameters: Defaults, ByRef, and MoreIn Excel VBA, a standard function parameter is a named input declared in the function’s parentheses, such as ByVal amount As Double.…VBA & macros
- Excel VBA Function vs Sub: Differences and ExamplesIn Excel VBA, a Function calculates and returns a value, while a Sub performs an action and does not return a value.…VBA & macros
- Excel VBA Function Return Value: Syntax and ExamplesAn Excel VBA function returns a value by assigning that value to the function’s own name before the function ends. For example,…VBA & macros
- Excel VBA Function Return Boolean Values: How It WorksYes. An Excel VBA function can return a Boolean value: declare the function with As Boolean, then assign True or False to…VBA & macros