Results 1 to 4 of 4

Thread: using sheet1 name
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Mar 2016
    Posts
    1,273
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default using sheet1 name

    Hi
    I have 3 sheets and they are showing in the vba editor/project window as following:

    - sheet1(hello1)
    - sheet2(hello2)
    - sheet3(hello3)

    I am moving these sheets around using vba code and I want to make sure that sheet1 is the active one after whatever move I do. I remember once I used code name to activate sheet1(hello1), but it does not work now

    Code:
    Sub abc()
        Workbooks(1).Sheet1.Activate
    End Sub
    I am trying to avoid using worksheets("hello1")
    Last edited by lezawang; Apr 29th, 2019 at 09:54 AM.

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    23,796
    Post Thanks / Like
    Mentioned
    401 Post(s)
    Tagged
    42 Thread(s)

    Default Re: using sheet1 name

    Do not specify the workbook.
    Codenames refer to the workbook, that contains the code
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    Board Regular
    Join Date
    Mar 2016
    Posts
    1,273
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default Re: using sheet1 name

    "Codenames refer to the workbook, that contains the code"
    Did not know that. Thank you so much.

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    23,796
    Post Thanks / Like
    Mentioned
    401 Post(s)
    Tagged
    42 Thread(s)

    Default Re: using sheet1 name

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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