Spreadsheet.CellsRange

This property returns/sets a cell range as a range.

This property is read only.

Syntax Parameters Return Value
ReadOnly Property Spreadsheet.CellsRange( _
    FirstRow As Integer, _
    FirstColumn As Integer, _
    LastRow As Integer, _
    LastColumn As Integer) As Range
  • FirstRow [in]

Type: Integer

  • FirstColumn [in]

Type: Integer

  • LastRow [in]

Type: Integer

  • LastColumn [in]

Type: Integer

Range

SVB Example

Marking and unmarking cells:

Option Base 1
Option Explicit
Sub Main
    Dim spr As Spreadsheet
    'assigns the active spreadsheet to the object spr
    Set spr = ActiveSpreadsheet
    Dim r As Range
    'assigns the range 1,1,2,2 to the range object r
    Set r = spr.CellsRange(1,1,2,2)
    'sets the range as marked cells
    r.AddToMarked
    'using the spreadsheet display attributes, displays the marked cells
    spr.DisplayAttribute(scDisplayMarkedCells) = True
    'displays a message box, when ok is pressed marked cells will be removed
    'the purpose of the message box is to pause execution so that
    'the marked cells can be seen.
    MsgBox("The marked cells will now be unmarked",vbOkOnly)
    'removes all the marked cells
    spr.UnMarkAll
End Sub