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
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