VBA Sumifs Type mismatch help

mdi

New Member
Joined
Jul 18, 2011
Messages
5
Hello I am trying to create a macro to run sumifs. I am getting a type mismatch error and I'm not sure why. Your help would be greatly appreicated!

Thanks!

Sub getIntercompany()
Dim OURange As Range
Dim vendorRange As Range
Dim AmountRange As Range
Dim AMStoSBA As Double

Sheets(1).Select
Set OURange = Range("A26", Range("A26").End(xlDown))
Set vendorRange = Range("D26", Range("D26").End(xlDown))
Set AmountRange = Range("K26", Range("K12").End(xlDown))

Sheets.Add After:=Sheets(1)
Sheets(2).Name = "Intercompany Transactions"
AMStoSBA = Application.SumIfs(AmountRange, OURange, 21, vendorRange, "NHRSBA")

MsgBox (AMStoSBA)
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi mdi,

maybe trying with:
Code:
AMStoSBA = [COLOR=Red]WorksheetFunction[/COLOR].SumIfs(AmountRange, OURange, 21, vendorRange, "NHRSBA")
Regards
 
Upvote 0
Maybe this

Code:
AMStoSBA = Application.SumIfs(Range("AmountRange"), Range("OURange"), 21, Range("vendorRange"), "NHRSBA")

HTH

M.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,710
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top