+ Reply to Thread
Results 1 to 6 of 6

Refer to a windown whos name is derived from a cell value in a formula

  1. #1
    Registered User
    Join Date
    02-14-2010
    Location
    Australia, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Refer to a windown whos name is derived from a cell value in a formula

    Any help with this one would be greatly appreciated.

    I want to tell the Index and Match formulas to refer to a window when the window's name is contained in an adjacent cell. The code below should make what I am trying to do clear:

    Please Login or Register  to view this content.
    However, I can't define "ActWin" in the way I have tried to above when it is defined as a Window. Changing the first line to "Dim ActWin As String" allows me to set ActWin equal to the value in the active cell however, I am then prompted to locate the file ActWin on my hard drive once the index/ Match formulas are put in.

  2. #2
    Registered User
    Join Date
    02-14-2010
    Location
    Australia, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Refer to cell value in formula

    Any help with this one would be greatly appreciated.

    I want to tell the Index and Match formulas to refer to a window when the window's name is contained in an adjacent cell. The code below should make what I am trying to do clear:

    Please Login or Register  to view this content.
    However, I can't define "ActWin" in the way I have tried to above when it is defined as a Window. Changing the first line to "Dim ActWin As String" allows me to set ActWin equal to the value in the active cell however, I am then prompted to locate the file ActWin on my hard drive once the index/ Match formulas are put in.

  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: Refer to cell value in formula

    You may have a misunderstanding of what Window is. When you talk about a Window's name, I think you really mean a Workbook's name. Window does not have a Name attribute. Regardless, this code just works with strings and doesn't really have to know anything about workbooks. I think you want something like this:

    Please Login or Register  to view this content.
    Excel will then try to evaluate the formula and if the file doesn't already exist it requires you to locate it. That is not an issue with VBA, it's just how external workbook references work when using INDEX. The same thing would happen if you just typed in the formula directly into a cell.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    02-14-2010
    Location
    Australia, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Refer to cell value in formula

    Thanks a lot.
    Works perfectly.

  5. #5
    Registered User
    Join Date
    03-08-2007
    Posts
    93

    Re: Refer to a windown whos name is derived from a cell value in a formula

    You have the variable name inside the quotation marks, so Excel thinks you want the exact letters ACTWIN inside the formula. You need to separate the text from the variable name as follows.

    Please Login or Register  to view this content.
    Hope this helps

    SAE

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Refer to a windown whos name is derived from a cell value in a formula

    Samnic, I've merged your two identical questions into one thread. In the future please take care not to post the same question twice.

    thanks

+ 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