ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA code to Fill Down in a filtered list only to visible cells. (https://www.excelbanter.com/excel-programming/423778-vba-code-fill-down-filtered-list-only-visible-cells.html)

Training Goddess

VBA code to Fill Down in a filtered list only to visible cells.
 
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

Patrick Molloy[_2_]

VBA code to Fill Down in a filtered list only to visible cells.
 
"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

"Training Goddess" wrote:

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



All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com