Hi
I am trying to do a SUMIFS in VBA. The below code works just perfect if I hardcode the arguments -
Sub Ageingformulas2()
Dim Customer As Range
Dim Bucket As Range
Dim Amount_GBP As Range
Set Customer = Sheets("K135512002").Range("G:G")
Set Bucket = Sheets("K135512002").Range("K:K")
Set Amount_GBP = Sheets("K135512002").Range("I:I")
With Sheets("K135512002")
Sheets("Mapping Table").Range("B13").Value = Application.WorksheetFunction.SumIfs(Amount_GBP, Customer, UK_BKKOREA, Bucket, 0-90 days)
End With
End Sub
When I change the code UK_BKKOREA to the value of Cell A13 and 0-90 days to Cell B12 it gives me a zero value.
The values in A13 will always change, so I do need this argument to look up the value in A13.
Below is an example of the code that returns a zero value
Sheets("Mapping Table").Range("B13").Value = Application.WorksheetFunction.SumIfs(Amount_GBP, Customer, A13, Bucket, B12)
So effectively I want the formula to work on whatever the value is of Cell A13 and not a hardcode value.
Can you PLEASE help????
I am trying to do a SUMIFS in VBA. The below code works just perfect if I hardcode the arguments -
Sub Ageingformulas2()
Dim Customer As Range
Dim Bucket As Range
Dim Amount_GBP As Range
Set Customer = Sheets("K135512002").Range("G:G")
Set Bucket = Sheets("K135512002").Range("K:K")
Set Amount_GBP = Sheets("K135512002").Range("I:I")
With Sheets("K135512002")
Sheets("Mapping Table").Range("B13").Value = Application.WorksheetFunction.SumIfs(Amount_GBP, Customer, UK_BKKOREA, Bucket, 0-90 days)
End With
End Sub
When I change the code UK_BKKOREA to the value of Cell A13 and 0-90 days to Cell B12 it gives me a zero value.
The values in A13 will always change, so I do need this argument to look up the value in A13.
Below is an example of the code that returns a zero value
Sheets("Mapping Table").Range("B13").Value = Application.WorksheetFunction.SumIfs(Amount_GBP, Customer, A13, Bucket, B12)
So effectively I want the formula to work on whatever the value is of Cell A13 and not a hardcode value.
Can you PLEASE help????
Last edited: