+ Reply to Thread
Results 1 to 9 of 9

MATCH mess

Hybrid View

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    texas
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: MATCH mess

    I appreciate the response, but with your code I still get an error 1004 when there is no match.
    The only reason for the IsNothig was to handle the error, which it did, but I can't figure out how to advance to the next n.

  2. #2
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    31

    Re: MATCH mess

    Sorry, it was erroring on the 2nd loop. Hadn't tested it thouroughly.

    Try this


    For n = 1 To 12
        On Error GoTo 0 'switch off error trap
        'Set ws1 = Sheets(n)
        Sheets(n).Activate
        On Error Resume Next
        Set myvalue = Nothing
        myvalue = WorksheetFunction.Match(rec, Range("A1:A150"), 0)
        If Not myvalue Is Nothing Then
            MsgBox (myvalue)
        End If
    10 Next n
    I can explain it if it works!

    Cheers

    Mat

  3. #3
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    31

    Re: MATCH mess

    Sorry, it was erroring on the 2nd loop. Hadn't tested it thouroughly.

    Try this


    For n = 1 To 12
        On Error GoTo 0 'switch off error trap
        'Set ws1 = Sheets(n)
        Sheets(n).Activate
        On Error Resume Next
        Set myvalue = Nothing
        myvalue = WorksheetFunction.Match(rec, Range("A1:A150"), 0)
        If Not myvalue Is Nothing Then
            MsgBox (myvalue)
        End If
    10 Next n
    I can explain it if it works!

    Cheers

    Mat

+ 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