Strooprover
New Member
- Joined
- Jul 21, 2017
- Messages
- 25
Hi,
I've got this code to copy the formula in F1 below for the amount of values in G1. But I think that in my last line I somehow give the order to copy the value of F1, instead of the formula of F1. At least, that's that happens in my worksheet. Can someone explain to me what I'm doing wrong?
I've got this code to copy the formula in F1 below for the amount of values in G1. But I think that in my last line I somehow give the order to copy the value of F1, instead of the formula of F1. At least, that's that happens in my worksheet. Can someone explain to me what I'm doing wrong?
Code:
Range("F1").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(Sheet1!C[-5],Sheet2!RC[+2])"
lastrow = Worksheets("Sheet2").Range("H1").End(xlDown).Row
With Worksheets("Sheet2").Range("F1")
.AutoFill Destination:=Range("F1:F" & lastrow)
End With