+ Reply to Thread
Results 1 to 22 of 22

return tab names down a column with vba

  1. #1
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    return tab names down a column with vba

    Hello. How do I return all tab names down a column in master sheet. So, A1= Sheet 1 name, A2, Sheet 2 name, etc.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    Please Login or Register  to view this content.
    Also, this can be done without VBA strictly with formulas:
    Tony Valko's Awesome Sheet List Formula
    Last edited by daffodil11; 06-03-2015 at 02:27 PM.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    Quote Originally Posted by daffodil11 View Post
    Please Login or Register  to view this content.
    hi sir!

    Does this code apply even if the worksheets' name is changed anytime during the process and the cells would dynamically adopt to these changes?

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    That VBA procedure would not, however it could be coded to that worksheet's specific coding to update whenever you select it.

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    Here is an example of the code you would apply to the master sheet to autoupdate:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    i see... thanks for the info..
    i'm really looking for ways as well on sheetname variations and i'm also having a very hard time since it's all VBA.

  7. #7
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    What do you mean with sheetname variations?

  8. #8
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    well, I'm wanting to achieve two scenarios actually...

    1. that a sheetname would change depending on a certain cell result, and
    2. that a cell from a master sheet would now adopt to the changes made on the sheetnames from the first condition.

  9. #9
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    A cell can dictate a sheet's name, sure.

    That worksheet's code would be something like:
    Please Login or Register  to view this content.
    And when you select the master, it would rewrite all of the sheet names to stay up to date.

  10. #10
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    sorry sir, i'm quite confused..

    does that code change the sheetname or change the cell name that copies the sheetname?

  11. #11
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    This code self-activates whenever the worksheet it's applied to changes the value of Cell A1.
    As soon as you hit Enter, the worksheet name changes to the words in A1.


    The previous code for Workbook_Activate would still apply, so that when you went back to the Master tab it would re-grab each worksheet name.

  12. #12
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    Here is an example for you to play with.
    Attached Files Attached Files

  13. #13
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    Quote Originally Posted by daffodil11 View Post
    A cell can dictate a sheet's name, sure.

    That worksheet's code would be something like:

    Please Login or Register  to view this content.
    And when you select the master, it would rewrite all of the sheet names to stay up to date.
    I tried the code sir and unfortunately it didn't work.. the Private Sub Worksheet_Change is highlighted. I placed the code in between my other VBA codes.

    It says:

    Compile Error:
    Ambiguous name detected: Worksheet_Change

  14. #14
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    Event code goes directly on the worksheet it applies to, not in a Module. Examine my example to see what goes where.

  15. #15
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    Quote Originally Posted by daffodil11 View Post
    Event code goes directly on the worksheet it applies to, not in a Module. Examine my example to see what goes where.
    kindly check on the codes sir:

    Please Login or Register  to view this content.

  16. #16
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    You can't have two macros with the identical names, you'll need to combine the various Events.

    Please Login or Register  to view this content.

  17. #17
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    Quote Originally Posted by daffodil11 View Post
    You can't have two macros with the identical names, you'll need to combine the various Events.

    Please Login or Register  to view this content.
    Unfortunately it still isn't working on my excel file, maybe because the cell it's referring to ( $h$8 ) is a data validation drop down list from a table range.

  18. #18
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    Depends how you choose it. Are you typing or just picking from the list?

  19. #19
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    Quote Originally Posted by daffodil11 View Post
    Depends how you choose it. Are you typing or just picking from the list?
    picking from a list.. the $H$8 reference on the code is a dropdown list under data validation.

  20. #20
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: return tab names down a column with vba

    Are there any formulas on the worksheet that depend on H8?

  21. #21
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    yeah there are as well... the Percentile Scores changes everytime there is a change on the data chosen from the list on H8

  22. #22
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    422

    Re: return tab names down a column with vba

    would you mind taking a look at the sheet I'm working on?

    ECR1.xlsm

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Return column names/field names from one table
    By mc84excel in forum Access Tables & Databases
    Replies: 11
    Last Post: 04-08-2015, 12:01 AM
  2. Replies: 2
    Last Post: 01-02-2015, 09:44 AM
  3. Function to return value based on column and row names
    By gori1084 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-24-2012, 03:30 PM
  4. look for value in cells in a row, return multiple column names
    By timbot18 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-27-2012, 04:10 PM
  5. [SOLVED] Search/lookup to return column and row names...
    By Speshul in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-20-2012, 05:12 PM

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