Results 1 to 10 of 10

Thread: Match Function Problem!!! (RESOLVED)

Threaded View

  1. #1

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    Match Function Problem!!! (RESOLVED)

    VBA Excel

    I keep getting an Error 2042 returned by the match function here. I have carfully set my Range variables to the correct columns and rows. The range objects are all dates. It seems no matter what I do I get that error. Any ideas? Here is the code:

    Code:
    Sub test()
        Dim matchstart As Range
        Dim matchend As Range
        Dim matchRange As Range
    
        c = CDate("1/28/2004")
    
        Set matchstart = Workbooks("datafile.xls").Sheets("futexpiry").Cells(2, 5)
        Set matchend = Workbooks("datafile.xls").Sheets("futexpiry").Cells(500, 5)
        Set matchRange = Workbooks("datafile.xls").Sheets("futexpiry").Range(matchstart, matchend)
        FirstMatch = Application.Match(c, matchRange, 1)
    End Sub
    Last edited by Avatarp; Feb 9th, 2004 at 05:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width