Results 1 to 8 of 8

type mismatch error when trying to populate array

Threaded View

  1. #1
    Registered User
    Join Date
    11-15-2013
    Location
    Philadelphia, PA
    MS-Off Ver
    Latest
    Posts
    15

    type mismatch error when trying to populate array

    Hello!

    I'm attempting to get a Query table to filter with an array made from the values in column A of another sheet.

    I'm having the worst of luck...I was pretty sure this would work but for some reason I'm getting a "type mismatch error '13'" attached to the line that says "sArray(i) = var1(i, 1)"

    My code:
    Sub SON()
    
    Dim srange As Range
    Set srange = Sheet13.Range("A2:A60")
    Dim var1 As Variant
    Dim sArray() As String
    Dim i As Long
    var1 = srange.Value
    
    ReDim sArray(1 To UBound(var1))
    
    For i = 1 To (UBound(var1))
        sArray(i) = var1(i, 1) ' here's where the error is...
    Next
    
    Sheet12.ListObjects("Table_Query_from_ELHR").Range.AutoFilter Field:=5, _
            Criteria1:=sArray, Operator:=xlFilterValues
            
    End Sub
    Could anyone tell me what I'm doing wrong?
    Last edited by neek13; 12-21-2013 at 03:36 PM. Reason: Solved !

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Date array function has type mismatch error...
    By secret2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2011, 02:07 PM
  2. Multi-Level Array Type Mismatch Error
    By CrazyFileMaker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2009, 06:20 PM
  3. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-09-2005, 01:54 AM
  4. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2005, 12:30 AM
  5. Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05:05 PM

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