Hi there,
For this example lets say I have two sheets, "Summary" and "Data".
In my Summary Sheet in column B I want write a sumifs formula where the value in column A (Summary) if it appears in "Data" sheet column M is summed and drag and drop this down to the last row where column A is populated as not to affect the formula i'll need to lock the range too. I think the below achieves this (i tried with absolute cell reference and it works).
However my issue is, I don't really wish to use !M:!M as I have many of these formula I need to run and querying every single cell is ineffective. in my Data sheet the columns the data will appear in is fixed so it will always be column M however the row numbers change. it will always start in row 2 but i do not know the end point. is there a way i can count the rows in 'Data sheet column M' then store this as a variable and use this variable as the range?
Ie something like
Thanks in advance
For this example lets say I have two sheets, "Summary" and "Data".
In my Summary Sheet in column B I want write a sumifs formula where the value in column A (Summary) if it appears in "Data" sheet column M is summed and drag and drop this down to the last row where column A is populated as not to affect the formula i'll need to lock the range too. I think the below achieves this (i tried with absolute cell reference and it works).
VBA Code:
Worksheets("Summary").Range("B3:B" & Cells(Rows.Count, "A").End(xlUp).Row).FormulaR1C1 = "=SUMIFS('Data'!M:!M,'Data'!M:!M,Summary!RC1)"
However my issue is, I don't really wish to use !M:!M as I have many of these formula I need to run and querying every single cell is ineffective. in my Data sheet the columns the data will appear in is fixed so it will always be column M however the row numbers change. it will always start in row 2 but i do not know the end point. is there a way i can count the rows in 'Data sheet column M' then store this as a variable and use this variable as the range?
Ie something like
VBA Code:
dim Example as Integer
set example = Worksheets("Data").Range("M3:M" & Cells(Rows.Count, "A").End(xlUp).Row)
Worksheets("Summary").Range("B3:B" & Cells(Rows.Count, "A").End(xlUp).Row).FormulaR1C1 = "=SUMIFS('Data'!M2:'Example','Data'!M2:!Example,Summary!RC1)"
Thanks in advance