i have the following method to set to define a ranga:
Set RegJan = Sheets("BD").Range("T3:T50000")
the range is smaller than this, but in order to make it work for some months, i set it to 50000 rows.
i then use this code in the following line of vba:
ws.Cells(8, 2).Value = Application.WorksheetFunction.SumIfs(RegJan,
EquipaBd, EquipaForm, AgenteBd, AgenteForm) 'Soma dos Registos
This last line i already transformed in a loop so that it calculates in every line i need it,the problem is that i have to do the first line of code for every month of the year an for 6 more variables
is there a better way of doing this? possibly a dynamic way?