I have a scheduling excel macro that lists everyday of the month as a separate excel worksheet. In my macro the "Sunday" sheets total the hourly hours worked per employee and give me the weekly total. I tried to create a function that will allow me to select which sheets I need as far as an upper and lower range but I can't get it to work. What is the issue? Currently I have:
Function SampleSum(ByVal ZZ As Integer, ByVal XX As Integer) As Integer
Application.Volatile
SampleSum = Sheets(ZZ).Range("BA5") + Sheets(XX).Range("BA5")
Sheets(XX).Range("BB5") = SampleSum
End Function
I would like to be able to "call" the function with any 2 number or variables taking the place of ZZ & XX.