Excel vba Autofill only empty cells
<p>I have a column A with data up to A300.</p>

<p>In this range, some of theses cells are empty, some contain values.</p>

<p>In VBA, I set the formula of the cell A1 then I use the autofill function to set it all over my column (up to A300) like this :</p>

<pre><code>ws.Range("A1").Select
Selection.AutoFill Destination:=ws.Range(ws.Cells(1, 1), ws.Cells(300, 1))
</code></pre>

<p>My problem is that datas contain on some cells are erased too ! I'm trying to autofill like it but only throught the empties cells.</p>

<p>I tried to add a filter on my worksheet like this :</p>

<pre><code>ws.Range("$A$1:$A$300").AutoFilter Field:=1, Criteria1:="="
</code></pre>

<p>Then I reused the autofill function, but it seems to fill thourght the filtered cells...</p>

<p>Can't we add a parameter like "only empties cells" to the autofill function ? Something like this :</p>

<pre><code>Selection.AutoFill Destination:=ws.Range(ws.Cells(1, 1), ws.Cells(300, 1)), Criteria1:="="
</code></pre>

<p>Thanks for your replies !</p>