Results 1 to 3 of 3

Thread: Need assist with sheet naming and probably other issues as well

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,709
    Location
    You are using "Sheet3$" as the name of a Database Table. Are you trying to retrieve data from a Database, or from a Worksheet?



    Using your various sheet "names"
    Sheets Are Objects
    Sheet3 and Sheet5 are the Object Names, referred to as Code Names. Object Names are implicitly declared Variables.
    ''By Excel
    Dim Sheet1 as Object
    Set Sheet1 = New Excel.WorkSheet
    Sheet1.Name = "Sheet1"
    "Current Cases" and "Archive" are the Sheet Names, or Tab Names as we refer to them to avoid semantic confusion. Tab names are Strings.

    In Code, you have to refer to them differently

    Sheets is a Collection Object, in this case a collection of all the Sheets in a Workbook.
    To refer to Worksheets in the Collection, you use the Tab name
    Sheets("Current Cases). Range("A2")
    To refer to a Sheet Object, use the Code Name Object
    Sheet3.Range("A2")
    Attachment 15400

    Note that Charts are (sheet) Objects too and are included in the Sheets Collection. They are referred to as Chart Objects and have Code Names and Tab Names. We call them Chart Sheets to avoid semantic confusion. ChartObject Objects are pretty colored graphics on a Chart Sheet and are referred to as Charts. Don't blame me, it was Bill Gates' idea.

    Last bit of technotrivia: There are three relevant Collections: Sheets, Worksheets and Charts. They contain, respectively, WorkSheets and Charts, WorkSheets, and Charts. (No, not the pretty colored graphics)
    Last edited by SamT; 02-12-2016 at 02:38 PM.
    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •