+ Reply to Thread
Results 1 to 3 of 3

Run-time error '424': Object required

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Run-time error '424': Object required

    Hi,

    I'm getting "Run-time error '424': Object required" when trying to execute the VBA below. Does anyone have a clue how to correct it?


    
    Sub btnUpdte_Click()
        Dim x, Dates, Times(1 To 48), i As Long, ii As Long, iii As Long, iv As Long, v As Long, vi As Long, vii As Long
        vi = 1
        x = Sheet2.Cells(1).CurrentRegion
        With Sheet1
            For i = 1 To 48
                Times(i) = CStr(Val(.Range("Times").Rows(i)))
            Next
            Dates = Application.Transpose(.[Dates])
        End With
        
        Application.ScreenUpdating = 0
        With [Schedule]
            .UnMerge
            .Interior.Color = xlNone
            .ClearContents
            For i = 2 To UBound(x, 1)
                If CDate(Format(x(i, 10), "mm/dd/yyyy")) >= [StartDate] And CDate(Format(x(i, 9), "mm/dd/yyyy")) <= [EndDate] Or Format(x(i, 9), "mm/dd/yyyy") < [EndDate] + 1 Then
                    x(i, 9) = Application.MRound(x(i, 9), "0:30")
                    x(i, 10) = Application.MRound(x(i, 10), "0:30")
                    If x(i, 9) <= [StartDate] Then
                        ddate = CDbl(CDate(Format(x(i, 10), "mm/dd/yyyy")))
                        iv = Application.Match(ddate, Dates, 1)
                    Else
                        ddate = CDbl(CDate(Format(x(i, 9), "mm/dd/yyyy")))
                        iv = Application.Match(ddate, Dates, 1)
                    End If
                    sStart = CStr(CDbl(CDate(Format(x(i, 9), "hh:mm"))))
                    ii = Application.Match(sStart, Times, 0)
                    sEnd = CStr(CDbl(CDate(Format(x(i, 10), "hh:mm"))))
                    iii = Application.Match(sEnd, Times, 0)
                    If x(i, 9) < [StartDate] Then ii = 1
                    If x(i, 10) >= [StartDate] + vi Then
                        vii = iii: iii = 49
                    End If
                    With .Cells(ii, iv).Resize(Abs((iii - ii)))
                        v = Application.Match(x(i, 12), [Codes], 0)
                        [Codes].Rows(v).Copy: .PasteSpecial xlPasteFormats
                        .Merge
                        .Value = x(i, 11)
                    End With
                    If x(i, 10) >= [StartDate] + vi And x(i, 10) < [EndDate] + 1 Then
                        With .Cells(1, iv + 1).Resize(vii - 1)
                            v = Application.Match(x(i, 12), [Codes], 0)
                            [Codes].Rows(v).Copy: .PasteSpecial xlPasteFormats
                            .Merge
                            .Value = x(i, 11)
                        End With
                    End If
                    If x(i, 10) >= [StartDate] + vi Then vi = vi + 1
                    If vi > 7 Then Exit For
                End If
            Next
            Application.Goto .Parent.[a1]
        End With
        
    End Sub
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim r As Range
        s = Target.Address
        Set r = Range(s)
        
        If Target.Count > 1 Then Exit Sub
        If Target.Column = 12 And Target.Row > 2 Then
            Application.EnableEvents = 0
            i = Application.Match(Target, [Codes], 0)
            [Codes].Rows(i).Copy: Target.PasteSpecial xlPasteFormats
            With Application
                .CutCopyMode = 0
                .EnableEvents = 1
            End With
        End If
        
    End Sub

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Run-time error '424': Object required

    When you DEBUG, which line of code?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Run-time error '424': Object required

    Hi,

    When running the code from Excel 2016 for Mac I get “Run-time error ‘424’: Object required” on Ln 14, Col1.
    When running the code from Excel 2010 for Windows I get instead “Run-time error ‘13’: Type mismatch” on Ln 29, Col1.

+ 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. [SOLVED] Run-time error '424' Object Required
    By Touch in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-03-2015, 02:40 AM
  2. [SOLVED] Simple Calendar pop up macro --> error Run-time error '424': Object required
    By am_hawk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2013, 10:38 AM
  3. VBA - “Run-time error 424: object required”
    By randiba in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2013, 07:28 AM
  4. Run-time error '424' (object required)
    By jovir in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2013, 08:49 AM
  5. Run-time error '424' object required
    By PaPaDiZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2011, 05:31 AM
  6. run time error '424' object required pl help
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-15-2010, 09:39 AM
  7. 424 run time error object required
    By nataliem in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-25-2007, 10:37 AM

Tags for this Thread

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