+ Reply to Thread
Results 1 to 6 of 6

Use of InputBox doesn't succeed in getting sheet name

  1. #1
    Registered User
    Join Date
    08-08-2012
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Use of InputBox doesn't succeed in getting sheet name

    I'm asking the user to identify source and destination worksheets for some data movement.

    I don't understand why this won't work (and have tried many less sensical alternatives!). When I run the function, if I navigate to another tab to select a range in response to the prompt (basically to ID the worksheet), ActiveSheet.name still is the sheet that I was on when I began running the function.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Use of InputBox doesn't succeed in getting sheet name

    I think it would be more practical to create a user form that contains combo boxes that list worksheet names in the active workbook and have the user select from those.

    Here's some sample code that loads combobox1 with the sheet names:
    Please Login or Register  to view this content.
    b

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Use of InputBox doesn't succeed in getting sheet name

    Hello ShawnW,

    You have ActiveSheet.Name assigned to GetDest. The code should be...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    08-08-2012
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Use of InputBox doesn't succeed in getting sheet name

    Thanks Leith, that works. I guess it was weird I wasn't using DestRange. Was just sort of setting that in the process of getting them to select a cell, which I thought would make ActiveSheet what I wanted it to be. Anyway, it works now.

    Ron, after doing some googling and not finding anything simple enough, and getting progressively less effective with tiredness setting in...I am not able to get a combobox working. (I don't know how to call it, etc.) If it's a simple explanation, I'd love to hear it, but I think I just might need more of an overall tutorial on it and I don't want to waste too much of your time.

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Use of InputBox doesn't succeed in getting sheet name

    Instead of an explanation...how about a working example?

    I attached a workbook that contains VBA code.

    ListWkbkSheets_v1a.xlsm

    Click the button on Sheet1 to view a userform that lists the sheets of that workbook.
    Click OK to see your selection.
    Click Cancel to .... well cancel.

    Change the OK button code to suit your needs.

    I hope that helps.

  6. #6
    Registered User
    Join Date
    08-08-2012
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Use of InputBox doesn't succeed in getting sheet name

    Thanks for the extra time, I managed to quickly find the UserForm code. I haven't used/created any forms yet! That will be very helpful.

    Thank you both for answering my original question and providing a more professional alternative.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1