Hello all,
I am trying to use a User Defined Function to shorten the parameters for a series of separate sumifs that reference a table. For some reason it won't let me reference the table. I keep getting a compile error: expected list or )
The table name is PivotsourceData and I am trying to make field1 my input as well as the year. Any help would be very useful
Here is what I have:
Public Function SumHours(ContYear As String, Field1 As String)
SumHours = worksheetfunction.SumIfs(Range(PivotSourceData[Field1]),Range(PivotSourceData[Contract year]),""ContYear"",PivotSourceData[Test type],""OP"")
End Function
I am trying to use a User Defined Function to shorten the parameters for a series of separate sumifs that reference a table. For some reason it won't let me reference the table. I keep getting a compile error: expected list or )
The table name is PivotsourceData and I am trying to make field1 my input as well as the year. Any help would be very useful
Here is what I have:
Public Function SumHours(ContYear As String, Field1 As String)
SumHours = worksheetfunction.SumIfs(Range(PivotSourceData[Field1]),Range(PivotSourceData[Contract year]),""ContYear"",PivotSourceData[Test type],""OP"")
End Function