Consulting

Results 1 to 4 of 4

Thread: Run-time error '424': Object Required

  1. #1

    Run-time error '424': Object Required

    I am receiving the error message
    "Run-time error '424': Object required"

    Can someone help me fix this, code below:


    Sub UpcomingPMsbyCell()
    
    Dim i As Long
    Dim lngEndRowInv As Long
    
    With Excel.Application.ActiveSheet
        i = 2
        lngEndRowInv = .Range("A" & .Rows.Count).End(xlUp).row
    
            While i <= lngEndRowIn
                   If WorksheetFunction.CountIf(.Columns(5), "Rotatives") <> 0 Then
                          .AutoFilterMode = False
                          .Range("A1:H1").AutoFilter
                          .Range("A1:H1").AutoFilter Field:=5, Criteria1:="Rotatives"
                          .Range("A1:H1").AutoFilter Field:=7, Criteria1:="Active"
                          .UsedRange.SpecialCells(xlCellTypeVisible).Copy _
                                Destination:=Dashboard.Range("A1")
                          .AutoFilterMode = False
                          Application.CutCopyMode = False
                  End If
                   i = i + 1
            Wend
    End With
    End Sub
    Last edited by SamT; 11-05-2019 at 07:10 PM.

  2. #2
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    552
    Location
    Hello j_williams,

    Try this...

    Sub UpcomingPMsbyCell()
    
    
        Dim i As Long
        Dim lngEndRowInv As Long
    
    
            With Excel.Application.ActiveSheet
                i = 2
                lngEndRowInv = .Range("A" & .Rows.Count).End(xlUp).Row
        
                While i <= lngEndRowInv
                    If WorksheetFunction.CountIf(.Columns(5), "Rotatives") <> 0 Then
                        .AutoFilterMode = False
                        .Range("A1:H1").AutoFilter
                        .Range("A1:H1").AutoFilter Field:=5, Criteria1:="Rotatives"
                        .Range("A1:H1").AutoFilter Field:=7, Criteria1:="Active"
                        .UsedRange.SpecialCells(xlCellTypeVisible).Copy Destination:=Dashboard.Range("A1")
                        .AutoFilterMode = False
                        Application.CutCopyMode = False
                    End If
                    i = i + 1
                Wend
            End With
    
    
    End Sub
    Sincerely,
    Leith Ross

    "1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG"

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Destination:=Dashboard.Range("A1")
    Is Dashboard a WorkSheet's Tab Name, A Worksheet's CodeName, or an Object's Name? Frim the Error, I suspect it is a WorkSheet's Tab Name. Try
    Destination:=Sheets("Dashboard").Range("A1")
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    Ahhh. Yes it's a worksheets name, this fixed it. Thank you!

Posting Permissions

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