+ Reply to Thread
Results 1 to 5 of 5

Index Match Formula in VBA, that utilises Workbook dynamic named ranges

  1. #1
    Registered User
    Join Date
    08-15-2013
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Index Match Formula in VBA, that utilises Workbook dynamic named ranges

    Hi,

    Firstly, thanks to everyone who has posted on here. I have frequently trawled the forums as a guest trying to solve problems and this has been a mine of information.

    Scenario:
    I am working on a macro that utilises two mirror workbooks, a current one and one from the week previous. The user opens the previous Workbook via the macro. At this point I would like the macro to insert an Index Match formula into a specific cell and perform the calculation. The name of the previous Workbook will change and as such I use the Macro to define the name of this Workbook within the formula. The formula itself is made up of dynamic named ranges that will automatically calculate for their own workbook. With the code I have I keep receiving the "Compile Error: Expected end of Statement / Syntax error" on the line containing the formula itself. Hopefully, I have explained my situation clearly enough, if not please let me know.

    The code I have so far is as follows:

    Please Login or Register  to view this content.
    In case anyone is wondering, I know I have sections commented out that I have already created but not utilising whilst testing.

    Thanks for any and all help.

    Jamie

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Index Match Formula in VBA, that utilises Workbook dynamic named ranges

    Looks like it's just a lack of spaces surrounding the ampersands. Try:

    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    08-15-2013
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Index Match Formula in VBA, that utilises Workbook dynamic named ranges

    Thanks OllyXLS,

    I did that and it cleared the Compile Error. Unfortunately, I have a slightly different error now.

    Run-Time error '1004': Application-defined or object-defined error

    A slightly modified version of my code is below. Please could you take a look and let me know what foolish thing I'm doing now

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Index Match Formula in VBA, that utilises Workbook dynamic named ranges

    Try losing the square brackets around the workbook name...

  5. #5
    Registered User
    Join Date
    08-15-2013
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Index Match Formula in VBA, that utilises Workbook dynamic named ranges

    Hi OllyXLS

    That solved it for me!

    Many Thanks,
    Jamie

+ 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. looking up specific cells utilizing named ranges, index/match in VBA?
    By hlep in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2012, 09:44 AM
  2. Dynamic named ranges with entire workbook scope
    By jeffreybrown in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-29-2011, 10:16 AM
  3. Replies: 2
    Last Post: 01-10-2011, 01:15 AM
  4. Utilizing Match & Index with two named ranges
    By purdue7997 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2009, 04:55 PM
  5. Named Ranges and INDEX/MATCH
    By jasoncw in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-19-2007, 09:33 AM

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