GTretick
Member
I have a attached a file with a mock sales data type table in it.
I want to create a VBA procedure that fills in a grid that looks at row and column headings and picks the correct information from the table.
I've started my code so that it fills in a value in each part of my grid using nested For routines. I've hard coded my Sumifs variables so that it has picked one set of conditions to enter into all cells.
What I want is to look at the values in columns A and B as well as the header in row 4 and amend the formula accordingly.
For instance in cell D9 the formula should adapt so that it inputs the value of 5 because...
it is referencing Table2[Units] rather than Table2[Calls]
it is referencing Morgan rather than Drew
it is referencing Montreal rather than New York
I have no idea as to what syntax to use for such a thing but I'm hopeful it's possible.
My actual workbook has lots of proprietary info in it and will ultimately reference more columns and more left side variables but presumably this simpler table could be adapted to something more complex. There would also be many rows that would add into the Sumifs. my example only shows one instance per variable set for simplicity.
Thanks again for any help.
I want to create a VBA procedure that fills in a grid that looks at row and column headings and picks the correct information from the table.
I've started my code so that it fills in a value in each part of my grid using nested For routines. I've hard coded my Sumifs variables so that it has picked one set of conditions to enter into all cells.
What I want is to look at the values in columns A and B as well as the header in row 4 and amend the formula accordingly.
For instance in cell D9 the formula should adapt so that it inputs the value of 5 because...
it is referencing Table2[Units] rather than Table2[Calls]
it is referencing Morgan rather than Drew
it is referencing Montreal rather than New York
I have no idea as to what syntax to use for such a thing but I'm hopeful it's possible.
My actual workbook has lots of proprietary info in it and will ultimately reference more columns and more left side variables but presumably this simpler table could be adapted to something more complex. There would also be many rows that would add into the Sumifs. my example only shows one instance per variable set for simplicity.
Thanks again for any help.