Description
Represents a worksheet, a Microsoft Excel version 4.0 macro sheet, or a Microsoft Excel version 4.0 international macro sheet.
Accessors
The Worksheet object is a member of the Worksheets collection. The Worksheets collection contains all the Worksheet objects in a workbook. Use the Add method to create a new worksheet and add it to the collection. To access a single member of the collection, use the Worksheets method with the index number or name of the worksheet as an argument.
The worksheet index number represents the position of the worksheet on the tab bar of the workbook. Worksheets(1) is the first (leftmost) worksheet in the workbook; Worksheets(Worksheets.Count) is the last. All worksheets are included in the index count, even if they are hidden.
The following example hides worksheet one in the active workbook.
Worksheets(1).Visible = False
The worksheet name is shown on the tab for the worksheet. Use the Name property to set or return the worksheet name. The following example protects the scenarios on the worksheet named "Sheet1."
Worksheets("sheet1").Protect password:="drowssap", scenarios:=True
The Worksheet object is also a member of the Sheets collection. The Sheets collection contains all of the sheets in the workbook (chart sheets, dialog sheets, modules, and worksheets). To access a single member of the collection, use the Sheets method with the index number or name of the sheet as an argument.
When a worksheet is the active sheet, you can use the ActiveSheet property to refer to it. The following example uses the Activate method to activate the worksheet named "Sheet 1," sets the page orientation to landscape mode, and then prints the worksheet.
Worksheets("sheet1").Activate ActiveSheet.PageSetup.Orientation = xlLandscape ActiveSheet.PrintOut
Properties
Application Property, AutoFilterMode Property, CircularReference Property, ConsolidationFunction Property, ConsolidationOptions Property, ConsolidationSources Property, Creator Property, DisplayAutomaticPageBreaks Property, EnableAutoFilter Property, EnableOutlining Property, EnablePivotTable Property, FilterMode Property, Index Property, Name Property, Next Property, OnCalculate Property, OnData Property, OnDoubleClick Property, OnEntry Property, OnSheetActivate Property, OnSheetDeactivate Property, Outline Property, PageSetup Property, Parent Property, Previous Property, ProtectContents Property, ProtectDrawingObjects Property, ProtectionMode Property, ProtectScenarios Property, StandardHeight Property, StandardWidth Property, TransitionExpEval Property, TransitionFormEntry Property, Type Property, UsedRange Property, Visible Property.
Methods
Activate Method, Arcs Method, Buttons Method, Calculate Method, Cells Method, ChartObjects Method, CheckBoxes Method, CheckSpelling Method, ClearArrows Method, Columns Method, Copy Method, Delete Method, DrawingObjects Method, Drawings Method, DropDowns Method, Evaluate Method, GroupBoxes Method, GroupObjects Method, Labels Method, Lines Method, ListBoxes Method, Move Method, Names Method, OLEObjects Method, OptionButtons Method, Ovals Method, Paste Method (DialogSheet or Worksheet Object), PasteSpecial Method (DialogSheet or Worksheet Object), Pictures Method, PivotTables Method, PivotTableWizard Method, PrintOut Method, PrintPreview Method, Protect Method, Range Method, Rectangles Method, Rows Method, SaveAs Method, Scenarios Method, ScrollBars Method, Select Method, SetBackgroundPicture Method, ShowAllData Method, ShowDataForm Method, Spinners Method, TextBoxes Method, Unprotect Method.