• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sumifs VBA Code Error

Dokat

Member
Hi,

I wrote below vba code to do sumifs calculation in attached sample sheet. However its returning "Run-Time Error 424 Object Required" error. I cant figure out whats causing the error. Can anyone help me ? Thanks


Code:
Sub SUMIFS()

Dim i As Variant
Dim condition As Range

For i = 1 To 8

HDD.Cells(i, 7) = WorksheetFunction.SumIfs(Source.Range("av3:av"), Source.Range("cb:cb"), HDD.Cells(i, 5), Source.Range("CF:CF"), HDD.Cells(i, 6))
HDD.Cells(i, 8) = WorksheetFunction.SumIfs(Source.Range("aw3:aw"), Source.Range("cb:cb"), HDD.Cells(i, 5), Source.Range("CF:CF"), HDD.Cells(i, 6))


Next i

End Sub
 

Attachments

  • Sumifs Sample Filexlsb.xlsb
    86.5 KB · Views: 10
Then you need to define it as such.

Replace all HDD with Sheets("HDD")

and...

Source with Sheets("Source").

Also, Your "av3:av" & "aw3:aw" should be "av:av" & "aw:aw".

Also I'm pretty sure you don't want i = 1 to 8 but not sure what you want exactly. Put in formula that produces the correct result in the cell for faster help.
 
Hi ,

I think the formulae to be coded are as follows :

In cell G8 : =SUMIF(Source!$CF$3:$CF$59, $F8,Source!$AV$3:$AV$59)

In cell H8 : =SUMIF(Source!$CF$3:$CF$59, $F8,Source!$AW$3:$AW$59)

These are then to be copied down.

Narayan
 
Back
Top