VBA code to Fill Down in a filtered list only to visible cells.

T

Training Goddess

VBA code to Fill Down in a filtered list only to visible cells.

I am trying to create a macro that will fill down in a column based on a
filtered column in a list. I'm creating a formula in a separate column which
I want to fill down to only the visible cells based on the filtered field.

i.e. I am filtering on Column C to show only values 'X'. Then in Column D, I
want a formula I create in the first record to be duplicated to all of the
visible cells/rows in that column to the bottom of the list.

Any ideas?

Thanks in advance!
Training Goddess
 
P

Patrick Molloy

"Goddess" i'm in lurve ;)

Sub Demo()

Dim cell As Range
Dim source As Range
Set source = Range("C2:C500")
For Each cell In source.SpecialCells(xlCellTypeVisible)
If cell <> "" Then
cell.Offset(, 1).FormulaR1C1 = Range("D2").FormulaR1C1
End If
Next


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top