+ Reply to Thread
Results 1 to 4 of 4

worksheet names in formulas

  1. #1
    Registered User
    Join Date
    04-23-2010
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2003
    Posts
    4

    worksheet names in formulas

    I need to crerate a formula (or a macro) that will reference a worksheet by sequence number instead of name. I need to apply this macro to multiple workbooks and the tab names may not always be equal.

    =MIN('Module9 - 6748'!J2:J100,'Module4 - 6748'!J2:J100) (named used in formulas)
    would like it to be:

    =MIN('FIRST SHEET'!J2:J100,'SECOND SHEET'!J2:J100

    Somehow referencing that this is the first tab, second tab, etc... witout having to rename all tabs on hundreds of sheets...
    Any thoughts?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: worksheet names in formulas

    My understanding is that if you rename a sheet, ALL formulas that refer to it are changed automatically, too. You shouldn't have to edit any formulas.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: worksheet names in formulas

    My understanding is that you want to be able to copy a formula from one workbook to another. This formula references ranges on other worksheets, and the names of worksheets vary from workbook to workbook. You want your formula to be independent of what the worksheets are named, and use only their positions on the list of tabs.

    The following UDF will do what you want. You need to create a new Module and put it in every workbook that needs to use it.

    Please Login or Register  to view this content.
    SheetIndex is the index of the worksheet. The index is based on the tab order.

    RangeRef is a string that provides the range.

    In your example, you would use the following formula:

    =MIN(SheetRange(1,"J2:J100",SheetRange(2,"J2:J100"))
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    04-23-2010
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: worksheet names in formulas

    That worked like a charm. Thanks!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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