Forum Discussion
Macro without hard coding data rows
The AVERAGE function ignores empty cells, so you could use the largest range you expect.
If you want to use the exact range we'd have to know in detail what you want to do.
- PointviewmanAug 22, 2022Copper ContributorThanks Hans.
Average function was a bad example. I use countifs and other functions too. Basic problem is that the range can be different in different files. How best to handle that?- HansVogelaarAug 23, 2022MVP
Please provide some details.
- PointviewmanAug 31, 2022Copper Contributor
See attached sample file. Rows 1 has variable names, rows 2-84 have data.
I begin analysis in cell BC100..you can see the formula in it. Then move down to cells BC101, BC 103 and so on and enter the formulae. I copy the formulas in BC100-BC106...to adjacent columns till col DV. Then i transpose the results matrix and sort (as you will see in the sheet).
I can record a macro to do all the above but i want the macro to adjust so that it does the calculations with all rows of data. In this case data is in rows 2-84. In the next case, data may be in rows 2-156. How do i make the macro adjust and use all available rows of data?
Thank you for your time