I am trying to fill a specific number of filtered cells with the certain value, stored in H1. I found the following code, on the web, which enables me to fill all of the filtered cells, but how can I limit the number of cells, which are filled. If the filtered data extends to ten cells, how can I stop the fill at say the eighth cell?
Dim cell As Range
Dim source As Range
Set source = Range("A2:A20")
For Each cell In source.SpecialCells(xlCellTypeVisible)
If cell <> "" Then
cell.Offset(, 2).Formula = Range("H1")
End If
Next
Dim cell As Range
Dim source As Range
Set source = Range("A2:A20")
For Each cell In source.SpecialCells(xlCellTypeVisible)
If cell <> "" Then
cell.Offset(, 2).Formula = Range("H1")
End If
Next