I am trying to find a vba code that will find blank cells in a certain column, and replace these cells with a formula that includes the range of cells above (up until the next blank cell)
for instance, cells A2:A15 are filled in, A16 is blank, I want a code that can find the blank C16, and insert the following code:
=COUNTIF(A2:A13,A2)=COUNTA(A2:A13)
I have about 72,000 rows, and there is not a uniform spacing between the blank cell ranges.
Thank you so much in advance!
This the what the code in have found
Sub Testing()
Dim Rng As Range, r As Range
Set Rng = Range("a2:a" & Range("a" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeConstants)
Top = Selection.End(xlUp).Value
For Each r In Rng.Areas
With r
.Cells(1, 1).Offset(.Rows.Count).Formula = "=countif(" & .Address & ", " & .Top & ") = CountA(" & .Address & ")" 'i got stucked with the code here. where i want to pick the first cell for every range.
End With
Next
End Sub