Results 1 to 4 of 4

Thread: Excel VBA Active WorkSheet Name

  1. #1

    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
    Bryan, TX


    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...


    It will not error if the RIGHT sheet is already active..
    Add-in for posting ranges as copyable tables (bottom of the page) -Win & Mac

    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


    Sub testme()
    Mysheet =
    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


    Thanks WORKS FINE.. I could not find it anywhere

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