I'm writing a macro and I would like to use an AVERAGEIF with a dynamic selection instead of a fixed selection.
At the moment I use this in my macro:
The problem is now, if I have more then 10000 rows, they will not be included in my AVERAGEIF.
I have created a variable to know how many rows 'sheet1' are used:
How can I, in my code, change 10000 with usedRangeSheet1?
At the moment I use this in my macro:
Code:
AVERAGEIF('sheet1'!R5C11:R10000C11,RC[-1],'sheet1'!R5C12:R10000C12)"
The problem is now, if I have more then 10000 rows, they will not be included in my AVERAGEIF.
I have created a variable to know how many rows 'sheet1' are used:
Code:
Dim usedRangeSheet1 As Integer
usedRangeSheet1 = Sheets("sheet1").usedRange.Rows.Count
How can I, in my code, change 10000 with usedRangeSheet1?