+ Reply to Thread
Results 1 to 10 of 10

Can the name of a worksheet be made to be a variable from another worksheet?

  1. #1
    Registered User
    Join Date
    09-10-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    5

    Can the name of a worksheet be made to be a variable from another worksheet?

    I am trying to have the name of a worksheet picked up from a list of names in another worksheet. Is that possible?
    For instance, I have a number of participants in a survey. I want to have the list of participants in a worksheet and I want other worksheets to be automatically updated when I enter the name of the participants in the list.
    Is that possible?

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    Yes its possible.

    Why dont you explain with the help of a sample?

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    09-10-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    Thank you but I probably didn't make myself clear.
    Inside a spreadsheet called "survey", I have a worksheet called "participants"; In it, I have a list of names. For instance, participant 1 is joe smith.
    I have another worksheet (inside "survey") named "participant 1".
    If I change the name of participant 1 from Joe Smith to Dave Jones, I would like the worksheet named "participant 1" to be changed to Dave Jones.
    Does this make sense?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    But how would the macro know which worksheet should be changed to Dave Jones? How would it know that participant 1 should be changed to Dave Jones? Should it go in the order that entry 1 is for worksheet1, entry 2 for worksheet 2, etc?

  5. #5
    Registered User
    Join Date
    09-10-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    Exactly.
    If I have 10 names in my list and 10 worksheets, I want the 10 worksheets to take the name of the 10 participants.
    Basically, I prepared a spreadsheet with generically named worksheets ("participant 1", "participant 2", etc...) and as soon as I have the actual name of the participants, I want to update my list and that automatically update the name of the worksheets.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    As long as the sheets take the order in which the entries are in the list, there should not be a problem.

    Will you always have pre-prepared sheets as participant1, participant2, etc?
    Last edited by arlu1201; 09-10-2012 at 11:11 AM.

  7. #7
    Registered User
    Join Date
    09-10-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    Yes, I will always have pre-prepared sheets as participant 1, participant 2, etc...

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    So can the macro do this?

    participant1 = entry1
    participant2 =entry2?

    Whats the name of the sheet containing this list and in which column will the list reside?

  9. #9
    Registered User
    Join Date
    09-10-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    The name of the sheet containing the participants is "participants"
    The names of the 12 participants are from b13 to b24.

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can the name of a worksheet be made to be a variable from another worksheet?

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

+ 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