+ Reply to Thread
Results 1 to 2 of 2

Filter array type mismatch

Hybrid View

  1. #1
    Registered User
    Join Date
    04-30-2013
    Location
    Can
    MS-Off Ver
    Excel 2010
    Posts
    3

    Filter array type mismatch

    Hi,

    I am having trouble creating the following macros and any and all help would be greatly appreciated. I am trying to reference column "F" after some cell manipulation to see if each row in column "M" exists.

    This is what I am doing:
    Create my array from row "F" from my row specified to the law row specified. Manipulating each variant in the array to contain the 2nd character until the 10th character (length of 8).
    Determine the range of row "M". In a FOR loop for the entirety of the range "M", store a String variable with the same length as my reference variable and check if the variable exists in the "F" array. If it does, move on. If it does not, change the row column to red and move on.

    Here is my code:

    Dim UserReports As Variant
    Dim Report As String
    Dim Length As Integer

    startrow = 4
    lastrow = Range("F65536").End(xlUp).Row
    Length = lastrow - startrow

    UserReports = Range("F" & startrow, "F" & lastrow)


    For i = 1 To (lastrow - startrow)

    UserReports(i, 1) = Mid(UserReports(i, 1), 2, 8)

    Next i

    Estartrow = 2
    Elastrow = Range("M65536").End(xlUp).Row
    x = Estartrow

    For x = Estartrow To (Elastrow)

    Report = Mid(Range("M" & x).Value, 5, 8).Value

    Z = Filter(UserReports, Report)

    'If Z >= 0 Then

    'Rng = "A" & x & ":" & "N" & x

    'End If

    Next x




    Thank you!!!!
    Shawn

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Filter array type mismatch

    filter only accepts 1D arrays-perhaps replace
    Z = Filter(UserReports, Report)
    by
    UserReports = application.transpose(userreports)
    Z = Filter(UserReports, Report)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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