Returns a Range object that represents all the cells that are currently visible. Read-only.
expression.VisibleRange
expression Required. An expression that returns one of the objects in the Applies To list.
Remarks
Do not confuse this property with the ViewableRange property, which returns a String that specifies the range that the user can view (part of that range may not be currently visible).
Example
This example sets the font to bold in every other column in the visible range on the active worksheet.
Sub Bold_Odd_Columns()
Dim rngColumn
'Loop through the visible columns.
For Each rngColumn In Spreadsheet1.ActiveWindow.VisibleRange.Columns
'Set the font to bold if the column is odd-numbered.
If rngColumn.Column Mod 2 = 0 Then
rngColumn.Font.Bold = True
End If
Next
End Sub
The function in this example returns True if the entire current region for cell A1 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 ragion, then
' return true.
IsCurrentRegionVisible = (rngIntersect.Address = rngCurrent.Address)
End Function