CurrentRegion Property

Microsoft Office Web Components Visual Basic

Returns a Range object that represents the current region. The current region is a range bounded by any combination of blank rows and blank columns. Read-only.

expression.CurrentRegion

expression    Required. An expression that returns a Range object.

Example

The function in this example returns True, if the entire current region for cell A1 on the active worksheet is visible (if the current region extends outside the visible range, the function returns False).

Function IsCurrentRegionVisible()
    Dim rngCurrent
    Dim rngVisible
    Dim rngIntersect

    ' Set the varible to the current region of cell A1.
    Set rngCurrent = Spreadsheet1.ActiveSheet.Cells(1, 1).CurrentRegion

    ' Set a variable to the currently visible range.
    Set rngVisible = Spreadsheet1.ActiveWindow.VisibleRange
 
    ' Set a variable to the overlapping portion of the current region
    ' and the visible range.
    Set rngIntersect = Spreadsheet1.RectIntersect(rngCurrent, rngVisible)

    ' If the overlapping region is the same as the current region, then
    ' return true.
    IsCurrentRegionVisible = (rngIntersect.Address = rngCurrent.Address)
End Function