Results 1 to 4 of 4

WorksheetFunction.match run time error '1004' with numbers but not text

Threaded View

Hussar13 WorksheetFunction.match run... 02-13-2013, 02:13 PM
TMS Re: WorksheetFunction.match... 02-13-2013, 02:40 PM
Hussar13 Re: WorksheetFunction.match... 02-13-2013, 04:36 PM
TMS Re: WorksheetFunction.match... 02-13-2013, 05:31 PM
  1. #1
    Registered User
    Join Date
    02-07-2013
    Location
    San Francisco Bay Area
    MS-Off Ver
    Excel 2004 for Mac
    Posts
    2

    WorksheetFunction.match run time error '1004' with numbers but not text

    First time poster and newbie/self-taught to vba. I’ve been reading through this forum and others as I build my program. Thank you for the help so far, and now I’m reaching out because I’m stuck.

    My program edits part number data via userform connecting back to the worksheet where the data was found.

    The error code reads:
    “Method of ‘Match’ of object ‘WorksheetFunction’ failed” run time error ‘1004’

    This only happens when the part number is numeric data like ‘5555555’.
    If the part number is text data like ‘T555555’ or ‘555555T’ the program executes correctly with no errors.

    I’ve searched the forum for similar issues and can’t find any answers. Maybe I’m not asking the right question?

    Any help is appreciated.


    The error producing code is below and the part number name is In_SubComPNmod. It’s pulled from a text box in the userform (I don’t want the PN to be modified) so it comes from the .caption.

    Dim PartNumRow As String
    
    'Make SubCom2 Active
    Sheets("StartHereSubCom").Activate
    
    'Determine PartNumRow
    
    PartNumRow = Application.WorksheetFunction.Match(In_SubComPNmod.Caption, Worksheets("StartHereSubCom").Range("A1:A999"), 0)
    MsgBox "Found Original PN at row : " & PartNumRow
    
    'Export Data to worksheet
    Cells(PartNumRow, 6).Value = In_SubComDescribe.Value
    Cells(PartNumRow, 15).Value = In_Material2.Value
    Cells(PartNumRow, 16).Value = In_Quantity2.Value
    Last edited by Hussar13; 02-13-2013 at 04:40 PM.

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