Consulting

Results 1 to 5 of 5

Thread: Solved: Find a sheet name

  1. #1
    VBAX Regular
    Joined
    Nov 2004
    Posts
    27
    Location

    Solved: Find a sheet name

    Hey,

    I need assistance with writing the code to place the sheet name in a variable that is directly to the right of a sheet named Index.

    Thanks

    ron

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You can't have a sheet named Index, Excel rejects it.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Sorry, that was juts my Excel playing up.

    Try this

    [vba]

    myVar = worksheets(worksheets("Index").index+1).name
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Bit of error checking might help

    [vba]

    If Worksheets("Index").Index < Worksheets.Count Then

    myVar = Worksheets(Worksheets("Index").Index + 1).Name
    Else

    MsgBox "Oops!"
    End If
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Nov 2004
    Posts
    27
    Location
    xld,

    It works perfect, thanks

    ron

Posting Permissions

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