Worksheet Object

The Worksheet object represents a worksheet document. Worksheet objects are created by the Documents.Add or Documents.Open methods of the Application object. Cells within a worksheet are accessed through the Cells, Rows, and Columns methods. The active cell and current selection are accessed through an AutoWksWindow object.

You can perform a mathematical transformation on worksheet cells, and import files into other files with the Worksheet object. Navigate to the WksRange object using the Cells, Rows, Columns, and UsedRange properties. Get and set cell values, modify cell formats, sort, and calculate statistics using the WksRange object.

Properties

DefaultColumnWidth

DefaultFormat

DefaultRowHeight

PageSetup

UsedRange

Methods

Cells

Columns

LoadDB

Merge

PrintOut

Range

Rows

SaveAs

Transform3

Transpose

Example

The following script demonstrates how the Worksheet object is used in reference to the Documents collection.

Sub Main

 

 'Declares GrapherApp as an object

  Dim GrapherApp As Object

 

 'Creates an instance of the Grapher Application object

 'and assigns it to the variable named "GrapherApp"

  Set GrapherApp = CreateObject("Grapher.Application")

 

 'Makes Grapher visible

  GrapherApp.Visible = True

 

 'Declares Wks as an object

  Dim Wks As Object

 

 'Creates a worksheet document in Grapher and

 'assigns it to the variable named "Wks"

  Set Wks = GrapherApp.Documents.Add(grfWksDoc)

 

End Sub