Results 1 to 5 of 5

Match(Indirect) returns error, added though VBA

Threaded View

  1. #1
    Registered User
    Join Date
    04-29-2015
    Location
    Melbourne
    MS-Off Ver
    2013
    Posts
    1

    Match(Indirect) returns error, added though VBA

    Hi all,
    I'm trying to add a formula into a cell by VBA

    Sub test()
    Sheets(4).Select
    ActiveWorkbook.Names.Add "tests", RefersTo:="=MATCH(INDIRECT(""B""&ROW()),$A:$A,-1)"
    Cells(1, 3).Formula = "=tests"

    End Sub

    However, it returns the #VALUE error because ROW() returns the value in the form of array (I think) like {1}, then it caused the error to the Indirect function which cannot process input like Indirect("B" & {1}).

    However, if I paste this formula: =MATCH(INDIRECT(""B""&ROW()),$A:$A,-1)
    directly into the cells, it works nicely.
    It also works in VBA if I use only Indirect function

    Anyone has ideas about this problem?

    Thanks
    Last edited by curuaxitin91; 05-27-2015 at 11:22 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Vlookup to Pivot Table, using Match function, returns error if can't find match value
    By AndrewHowarth in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-16-2015, 12:10 AM
  2. [SOLVED] Help with vlookup code - returns error if no match
    By cajand in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2014, 06:53 PM
  3. INDIRECT working, but then returns error ?
    By thedreamshaper in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-22-2014, 06:04 PM
  4. Replies: 8
    Last Post: 05-08-2013, 11:47 AM
  5. [SOLVED] MATCH/INDEX Formula Returns an Error Instead of 0
    By livifivil in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2013, 04:18 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