Consider:
Cells(2, "Q").Formula = "=COUNTIF(P$1:P1,P2)=0"
How do I insert these formulae when I have a variable holding a value?
I have to start the formula at 3550 row and 4000 row somtimes. It depends on the data. Well, when I googled it, I found nothing. They all used the same formula, but I need to insert the countif
function at a particular cell, may be at 300 or 500 - it depends in the variable value.
Cells(count,"Q").formula = "=COUNTIF(cells($1,"P"):cells(count-1,"P"),cells(count,"P))=0"
Is this the way? Well, I tried in some ways but it's ending up higlighting the line with the red colour. How do I insert these formulae with a variable?
Try this:
Reference: Issun's answer to Stack Overflow question How do I insert the formula into the cell when the formula keeps changing with increase in row?.