+ Reply to Thread
Results 1 to 5 of 5

Runtime Error 1004 and Runtime Error 13

Hybrid View

  1. #1
    Registered User
    Join Date
    04-18-2020
    Location
    QLD, Australia
    MS-Off Ver
    365
    Posts
    5

    Runtime Error 1004 and Runtime Error 13

    'ISSROWTARGET should return the row of the selected from ISS_ID_DD_Combo box'
    'Dyn_Range is a dinamic range =OFFSET(Data_Master!$B$6,0,0,Engine!$D$2,1)
    'The range for the interger atm is 5 lines'
    'This results in a Runtime Error 1004 ISSROWTARGET = Application.WorksheetFunction.Match(ISS_ID_DD_Combo, Sheets("Data_Master").Range("Dyn_Range"), 0)'
    'This results in a Runtime Error 13 ISSROWTARGET = Application.Match(ISS_ID_DD_Combo, Sheets(4).Range("Dyn_Range"), 0)

    Private Sub CommandButton1_Click()
    
    
    
    Dim ISSROWTARGET As Integer
    
    
    ISSROWTARGET = Application.Worksheetfuction.Match(ISS_ID_DD_Combo, Sheets("Data_Master").Range("Dyn_Range"), 0)
    
    
    
    MsgBox ISSROWTARGET
    
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Runtime Error 1004 and Runtime Error 13

    Hi there,

    A value read from a ComboBox is a string value, and you're trying to compare it with a numeric value in the worksheet.

    See if using the following line of code helps:

    
    ISSROWTARGET = Application.Worksheetfuction.Match(CInt(ISS_ID_DD_Combo), Sheets("Data_Master").Range("Dyn_Range"), 0)

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    04-18-2020
    Location
    QLD, Australia
    MS-Off Ver
    365
    Posts
    5

    Re: Runtime Error 1004 and Runtime Error 13

    Greg you are an absolute legend I have been struggling with this for 3 days, I did suspect that was the problem but couldn't find how to change the properties from text to Numbers.

    Again Thankyou

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Runtime Error 1004 and Runtime Error 13

    To take it one more step, this would avoid an error if no match found...

    Private Sub CommandButton1_Click()
        
        Dim ISSROWTARGET As Variant
        
        If ISS_ID_DD_Combo.ListIndex > -1 Then
        
            ISSROWTARGET = Application.Match(Val(ISS_ID_DD_Combo), Sheets("Data_Master").Range("Dyn_Range"), 0)
        
            If IsNumeric(ISSROWTARGET) Then
                msgbox ISSROWTARGET
            Else
                msgbox "No Match found.", , ""
            End If
        
        End If
        
    End Sub
    Last edited by AlphaFrog; 04-21-2020 at 12:44 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Runtime Error 1004 and Runtime Error 13

    Hi again,

    Many thanks for your very prompt feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA error: runtime error 1004 : Method range of object - 'Global' failed.
    By Afjio12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2019, 04:37 AM
  2. Runtime error 1004 & runtime error 424
    By MrWhiskey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-29-2017, 08:57 AM
  3. Runtime error '1004': Paste special method of range class error.
    By Daryl Zer0 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-05-2014, 01:44 AM
  4. [SOLVED] VBA Error: Runtime Error 1004: AutoFilter method of Range class failed
    By jl22stac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 07:27 PM
  5. [SOLVED] Range error in code, runs alone but not inside my full program, giving runtime error 1004
    By charizzardd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2012, 03:34 PM
  6. runtime error 1004 general odbc error
    By habj04ae in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2012, 05:59 AM
  7. Excel 2003 Macro Error - Runtime error 1004
    By Cow in forum Excel General
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM

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