Range
| API | Description | Example |
|---|---|---|
| Worksheet.Range | Function that specifies a specific range of the designated sheet | let sheet = instance.Application.ActiveSheet; let cell = sheet.Range("A1"); let range = sheet.Range("A1:B2"); |
| Range.Cells | Property that returns a range object that manages the specified range by cell units | let range = instance.Application.ActiveSheet.UsedRange; let cells = range.Cells; |
| Range.Column | Property that returns the column number of the top-left cell of the specified range | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.Column); |
| Range.Columns | Property that returns a range object that manages the specified range by column units | let range = instance.Application.ActiveSheet.UsedRange; let columns = range.Columns; |
| Range.Count | Property that returns the number of cells in the specified range | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.Count); |
| Range.EntireColumn | Property that returns a range object that manages the entire column of the specified range | let range = instance.Application.ActiveSheet.UsedRange; let entireColumn = range.EntireColumn; |
| Range.EntireRow | Property that returns a range object that manages the entire row of the specified range | let range = instance.Application.ActiveSheet.UsedRange; let entireRow = range.EntireRow; |
| Range.HasArray | Property that returns whether the specified range is part of an array formula cf) Works normally when range is a single cell (A1) | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.HasArray); |
| Range.HasFormula | Property that returns whether the specified range contains formulas cf) Works normally when range is a single cell (A1) | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.HasFormula); |
| Range.Hidden | Property that returns or changes the hidden state when the specified range consists only of columns or rows | let columns = instance.Application.ActiveSheet.Columns; console.log(columns.Item("A").Hidden); columns.Item("A").Hidden = true; |
| Range.Left | Property that returns the top-left X coordinate position of the specified range in points (pt) | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.Left); |
| Range.Next | Property that returns a range object corresponding to the next cell of the specified range | let range = instance.Application.ActiveSheet.UsedRange; let nextCell = range.Next; |
| Range.Previous | Property that returns a range object corresponding to the previous cell of the specified range | let range = instance.Application.ActiveSheet.UsedRange; let previousCell = range.Previous; |
| Range.Row | Property that returns the row number of the top-left cell of the specified range | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.Row); |
| Range.Rows | Property that returns a range object that manages the specified range by row units | let range = instance.Application.ActiveSheet.UsedRange; let rows = range.Rows; |
| Range.ShrinkToFit | Property that returns or changes whether the specified range automatically adjusts column width to fit data | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.ShrinkToFit); range.ShrinkToFit = true; |
| Range.Top | Property that returns the top-left Y coordinate position of the specified range in points (pt) | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.Top); |
| Range.Address | Function that returns the specified range as a string | let range = instance.Application.ActiveSheet.UsedRange; console.log(range.Address()); |
| Range.End | Function that returns a range object corresponding to the end cell of the column or row of the top-left cell of the specified range | let range = instance.Application.ActiveSheet.Range("D3:F6"); let d1Cell = range.End(instance.Enums.XlDirection.xlUp); let a3Cell = range.End(instance.Enums.XlDirection.xlToLeft); |
| Range.Item | Function that returns a range object corresponding to a cell at a specific index within the specified range | let range = instance.Application.ActiveSheet.Range("D3:F6"); let d3Cell = range.Item(1); let e3Cell = range.Item(2); let e4Cell = range.Item(2, 2); |
| Range.Offset | Function that returns a range object at a position moved by a specific offset from the specified range | let range = instance.Application.ActiveSheet.Range("D3:F6"); let d4f7Range = range.Offset(1); let d2f5Range = range.Offset(-1); let e4g7Range = range.Offset(1, 1); |
| Range.Resize | Function that returns a changed range object by modifying the size of the specified range | let range = instance.Application.ActiveSheet.Range("D3:F6"); let d3f4Range = range.Resize(2); let d3e4Range = range.Resize(2, 2); let d3h7Range = range.Resize(5, 5); |
| Range.Activate | Function that activates a specific cell within the selected range when the range is selected | let range = instance.Application.ActiveSheet.Range("A1:B2"); let a1Cell = instance.Application.ActiveSheet.Range("A1"); range.Select(); a1Cell.Activate(); |
| Range.AutoFit | Function that appropriately changes the size when the specified range is an object managed by row or column units | let a1Cell = instance.Application.ActiveSheet.Range("A1"); a1Cell.Columns.AutoFit(); // Auto-adjust column A width a1Cell.Rows.AutoFit(); // Auto-adjust row 1 height |
| Range.Calculate | Function that recalculates formulas within the specified range | let range = instance.Application.ActiveSheet.UsedRange; range.Calculate(); |
| Range.Clear | Function that removes data, formatting, etc. within the specified range | let range = instance.Application.ActiveSheet.UsedRange; range.Clear(); |
| Range.ClearContents | Function that removes data within the specified range | let range = instance.Application.ActiveSheet.UsedRange; range.ClearContents(); |
| Range.ClearFormats | Function that removes formatting within the specified range | let range = instance.Application.ActiveSheet.UsedRange; range.ClearFormats(); |
| Range.ColumnDifferences | Function that returns a range object with cells that have different data from a specific cell within the range managing the specified column | let range = instance.Application.ActiveSheet.Range("A1:A4"); let a1Cell = instance.Application.ActiveSheet.Range('A1'); range.Value2 = [ ['Example'], ['ohter'], ['Example'], ['other2'] ]; console.log(range.ColumnDifferences(a1Cell).Address()); // Outputs $A$2,$A$4 to console |
| Range.DataSeries | Function that adds continuous data to the specified range | let range = instance.Application.ActiveSheet.Range("A1:A12"); range.End(instance.Enums.XlDirection.xlUp).Formula = "31-JAN-1996"; // Input data in A1 cell range.DataSeries({ Type: instance.Enums.XlDataSeriesType.xlChronological, Date: instance.Enums.XlDataSeriesDate.xlMonth }); // Input continuous data based on months in each cell A1:A12 |
| Range.Delete | Function that removes the specified range | let range = instance.Application.ActiveSheet.Range("A1:B2"); range.Delete(); // After A1:B2 range is removed, rows 1~2 are pulled to the left range.Delete(instance.Enums.XlDeleteShiftDirection.xlShiftUp); // After A1:B2 range is removed, columns A~B are pulled range.Rows.Delete(); // Remove rows 1~2 range.Columns.Delete(); // Remove columns A~B |
| Range.FillDown | Function that fills the remaining range with the data from the topmost range of the specified range | let range = instance.Application.ActiveSheet.Range("A1:C3"); range.Value2 = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]; // A B C // 1 2 3 // 4 5 6 // 7 8 9 range.FillDown(); // A B C // 1 2 3 // 1 2 3 // 1 2 3 |
| Range.FillLeft | Function that fills the remaining range with the data from the rightmost range of the specified range | let range = instance.Application.ActiveSheet.Range("A1:C3"); range.Value2 = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]; // A B C // 1 2 3 // 4 5 6 // 7 8 9 range.FillLeft(); // A B C // 3 3 3 // 6 6 6 // 9 9 9 |
| Range.FillRight | Function that fills the remaining range with the data from the leftmost range of the specified range | let range = instance.Application.ActiveSheet.Range("A1:C3"); range.Value2 = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]; // A B C // 1 2 3 // 4 5 6 // 7 8 9 range.FillRight(); // A B C // 1 1 1 // 4 4 4 // 7 7 7 |
| Range.FillUp | Function that fills the remaining range with the data from the bottommost range of the specified range | let range = instance.Application.ActiveSheet.Range("A1:C3"); range.Value2 = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]; // A B C // 1 2 3 // 4 5 6 // 7 8 9 range.FillUp(); // A B C // 7 8 9 // 7 8 9 // 7 8 9 |
| Range.Insert | Function that inserts an empty range into the specified range cf) Format of adjacent range is replicated | let range = instance.Application.ActiveSheet.Range("A1:B2"); range.Insert(); // After A1:B2 range is inserted, rows 1~2 are pushed to the right range.Rows.Insert(); // Add rows 1~2 range.Columns.Insert(); // Add columns A~B |
| Range.RowDifferences | Function that returns a range object with cells that have different data from a specific cell within the range managing the specified row | let range = instance.Application.ActiveSheet.Range("A1:D1"); let a1Cell = instance.Application.ActiveSheet.Range('A1'); range.Value2 = ['Example', 'ohter', 'Example', 'other2']; console.log(range.RowDifferences(a1Cell).Address()); // Outputs $B$1,$D$1 to console |
| Range.Select | Function that processes the specified range as selected | let range = instance.Application.ActiveSheet.UsedRange; range.Select(); |
Related Features
Spreadsheet Basic Functions , Engine Global Management , Integrated Document Management , Integrated Document , Sheet Management , Sheet , Area , Engine Object Common