Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    Using a textbox input as variable (xppro 2003)

    Hi

    I am trying to use a variable created from a textbox input to navigate to a worksheet with that name. No joy!

    I can create a new worksheet and rename it using the variable but......!

    Can anyone help

    cheers
    cheers

    Phil Carter

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a textbox input as variable (xppro 2003)

    Say that you have a variable strSheetName. You have filled it with a valid sheet name. The instruction

    Worksheets(strSheetName).Select

    should activate the sheet whose name is in strSheetName.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    Re: Using a textbox input as variable (xppro 2003)

    Hans once again thanks fro that.

    Works great.

    All the commentary I have seen says to just use Sheets(strName).select!

    cheers
    cheers

    Phil Carter

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using a textbox input as variable (xppro 2003)

    Both Worksheets(strName).Select and Sheets(strName).Select should work. The Worksheets collection includes only worksheets (with a grid of cells), the Sheets collection includes both worksheets and chart sheets.

Posting Permissions

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