K0st4din
Well-known Member
- Joined
- Feb 8, 2012
- Messages
- 501
- Office Version
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hello,
please someone for help with this macro.
I wrote it manually, but when I open Alt + F11, I get some completely different formula from what I use.
What I'm trying to do is the following:
in the active worksheet from cell O2 to the end (because I do not know where the end will be)
I want to put this formula from cell "O2" and manually - pull down to the end
[TABLE="width: 514"]
<tbody>[TR]
[TD] =COUNTIFS($G$2:$G2; $G2;$J$2:$J2; $J2) - in O2[/TD]
[/TR]
[TR]
[TD] =COUNTIFS($G$2:$G3; $G3;$J$2:$J3; $J3) - in O3[/TD]
[/TR]
[TR]
[TD] =COUNTIFS($G$2:$G4; $G4;$J$2:$J4; $J4) - in O4[/TD]
[/TR]
</tbody>[/TABLE]
to the end
When I started to write it manually, the macro itself showed me a completely different formula and I do not know how to do it
Thanks in advance to everyone.
please someone for help with this macro.
I wrote it manually, but when I open Alt + F11, I get some completely different formula from what I use.
What I'm trying to do is the following:
in the active worksheet from cell O2 to the end (because I do not know where the end will be)
I want to put this formula from cell "O2" and manually - pull down to the end
[TABLE="width: 514"]
<tbody>[TR]
[TD] =COUNTIFS($G$2:$G2; $G2;$J$2:$J2; $J2) - in O2[/TD]
[/TR]
[TR]
[TD] =COUNTIFS($G$2:$G3; $G3;$J$2:$J3; $J3) - in O3[/TD]
[/TR]
[TR]
[TD] =COUNTIFS($G$2:$G4; $G4;$J$2:$J4; $J4) - in O4[/TD]
[/TR]
</tbody>[/TABLE]
to the end
When I started to write it manually, the macro itself showed me a completely different formula and I do not know how to do it
Code:
Sub Two_mounths()
Range("O2").Select
ActiveCell.FormulaR1C1 = "=COUNTIFS(RC7:RC7,RC7,R2C10:RC10,RC10)" 'this line
Range("O2").Select
Selection.AutoFill Destination:=Range("O2:O1231")
Range("O2:O1231").Select
Range("O1").Select
ActiveWorkbook.Save
Range("O1").Select
End Sub