Worksheet.UsedRange Property
Gets a Microsoft.Office.Interop.Excel.Range object that represents all the cells that have contained a value at any time.
Namespace: Microsoft.Office.Tools.Excel
Assemblies: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
ReadOnly Property UsedRange As Range
Range UsedRange { get; }
Property Value
Type: Microsoft.Office.Interop.Excel.Range
A Microsoft.Office.Interop.Excel.Range object that represents all the cells that have contained a value at any time.
Remarks
A used range includes any cell that has ever been used. For example, if cell A1 contains a value, and then you delete the value, then cell A1 is considered used. In this case, the UsedRange property will return a range that includes cell A1.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.