RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 801
- Office Version
- 365
- Platform
- Windows
Hi guys, I'm building a tool which opens two different workbooks which I DIM as Workbook called "Rep1" and "Rep2" in VBA.
What I need to do is reference them in a SUMIFS formula, like this:
Ignoring the fixed sum references for the minute, which I do know how to change, I can't remember how to reference the name. I know it's something like ' & Rep1.name & ' but I can't remember exactly what I replace and obviously the errors I get in VBA are just saying "This formula isn't right" lol.
If anyone can help jog my memory that would be super duper. Thanks.
EDIT:
Actually I've evidently also forgotten how to reference a bloody dynamic range too, it should be something like:
R7C7:R" & LastrowRep1 - 1 & "C7
Right?
What I need to do is reference them in a SUMIFS formula, like this:
VBA Code:
Range("C3:C" & Lastrow).FormulaR1C1 = "=SUMIFS('[Rep1.xlsx]1'!R7C7:R6833C7,'[Rep1.xlsx]1'!R7C3:R6833C3,RC[-2])"
Ignoring the fixed sum references for the minute, which I do know how to change, I can't remember how to reference the name. I know it's something like ' & Rep1.name & ' but I can't remember exactly what I replace and obviously the errors I get in VBA are just saying "This formula isn't right" lol.
If anyone can help jog my memory that would be super duper. Thanks.
EDIT:
Actually I've evidently also forgotten how to reference a bloody dynamic range too, it should be something like:
R7C7:R" & LastrowRep1 - 1 & "C7
Right?