Results 1 to 13 of 13

Testing for existence of value in array throws an error

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Testing for existence of value in array throws an error

    While adding new values to an array I'd like to check with each new value if it already exists in the array.
    The following however throws an error on this line
    If IsNumeric(Application.Match(Cells(w, 6).Value, Arrr, 0)) Then
    invalid procedure call or argument
    Dim Arrr() As Variant
    Count = 0
    For w = 4 To 37
    
        If IsNumeric(Application.Match(Cells(w, 6).Value, Arrr, 0)) Then
            abc = True
        Else
            abc = False
        End If
    
        If Cells(w, 5).Value = "NO" And abc = False Then
            Count = Count + 1
            ReDim Preserve Arrr(1 To Count)
            Arrr(Count) = Cells(w, 6).Value
        End If
    Next w
    Link to file
    Last edited by Jonathan78; 08-25-2017 at 04:03 AM. Reason: Link to file added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code Issues: Throws error everytime I add a row
    By jaredmccullough in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2014, 11:52 AM
  2. Error when testing for existence of shape object
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2012, 09:13 PM
  3. How to check for existence of PageField and what is error 1004
    By Thamizh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2011, 09:31 AM
  4. Simple If statement throws an error
    By ronanm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2011, 10:07 AM
  5. workbook.open throws 1004 error
    By gary.smith@primeexalia.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2006, 06:45 PM
  6. How do I perform a certain function if VBA throws up an error?
    By Matt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2006, 11:10 AM
  7. testing the existence of a formula in a cell
    By jérome Yacc in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-07-2005, 12:23 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