Excel VBA Active WorkSheet Name

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Excel VBA Active WorkSheet Name

  1. #1
    New Member
    Join Date
    Mar 2007
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Excel VBA Active WorkSheet Name

     
    I would like to find out the WorkSheet Name Of the Current work sheet so that I may check it to see if the user is on the right WorkSheet.

    If variable <> "RIGHT" Then
    I then want to make the correct sheet active using the name I just tested for.

  2. #2
    MrExcel MVP Jonmo1's Avatar
    Join Date
    Oct 2006
    Location
    Bryan, TX
    Posts
    43,779
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    0 Thread(s)

    Default

    x = ActiveSheet.Name
    If x <> "RIGHT" then Sheets("RIGHT").Select


    Although, it might be simpler just to select the correct sheet, rather than test if the right sheet is selected first...

    Sheets("RIGHT").Select

    It will not error if the RIGHT sheet is already active..
    Use the MrExcel HTML Maker to post nicely formatted tables in your forum posts.
    Find a link in post number 31

    The more we learn, and the better we get at our trade, the easier it becomes to overlook the obvious.

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.
    Ferris Bueller A.K.A. John Hughes, 1986

  3. #3
    Board Regular ADAMC's Avatar
    Join Date
    Mar 2007
    Location
    UK
    Posts
    1,142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sub testme()
    Mysheet = ActiveSheet.name
    If Mysheet <> "Sheet1" Then Sheets("Sheet1").Activate
    End Sub

    But if the user only needs one sheet why not activate that in a workbook open or something?
    ADAMC (",)

    If everything seems to be going well, you have obviously overlooked something.

  4. #4
    New Member
    Join Date
    Mar 2007
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thanks WORKS FINE.. I could not find it anywhere

User Tag List

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
  •  

 

 
DMCA.com