NamedRange.CurrentRegion Property (2007 System)

Gets a Range that represents the current region.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property CurrentRegion As Range
'Usage
Dim instance As NamedRange 
Dim value As Range 

value = instance.CurrentRegion
[BrowsableAttribute(false)]
public Range CurrentRegion { get; }
[BrowsableAttribute(false)]
public:
property Range^ CurrentRegion {
    Range^ get ();
}
public function get CurrentRegion () : Range

Property Value

Type: Range
A Range that represents the current region.

Remarks

The current region is a range bounded by any combination of blank rows and blank columns.

This property cannot be used on a protected worksheet.

Examples

The following code example creates a NamedRange and populates it with the value 123. It then colors the current region, which is the region bounded by blank rows and columns, green.

This example is for a document-level customization.

Private currentRegionRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub ColorCurrentRegion()
    currentRegionRange = Me.Controls.AddNamedRange( _
        Me.Range("C3", "E5"), "currentRegionRange")
    currentRegionRange.Value2 = "123" 

    ' Set the color of the region to the RGB value for green. 
    Me.currentRegionRange.CurrentRegion.Interior.Color = &HFF00
End Sub
Microsoft.Office.Tools.Excel.NamedRange currentRegionRange;
private void ColorCurrentRegion()
{
    currentRegionRange = this.Controls.AddNamedRange(
        this.Range["C3", "E5"], "currentRegionRange");
    currentRegionRange.Value2 = "123";

    // Set the color of the region to the RGB value for green. 
    this.currentRegionRange.CurrentRegion.Interior.Color = 0xFF00;
} 

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace