Forum Discussion

TP700's avatar
TP700
Copper Contributor
Oct 18, 2023

Filldown VBA not working

Hello, I have some coding which filters some columns to find data I need to add a comment against, then writes the comment and fills it down to the bottom. However, the Filldown isn't working. Everything works fine up until that point, once it gets to the Selection.filldown, it just doesn't do anything, there is no error message it just doesn't do anything. Any ideas what I am missing? Thanks

 

Sub Description()

Dim lastRow As Long
lastRow = Cells(Rows.Count, "AB").End(xlUp).Row

Range("AB1:AB" & lastRow).Offset(1, 0).SpecialCells(xlCellTypeVisible).Areas(1).Rows(1).Select

Sheets("Data").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells.Select
Cells.EntireColumn.AutoFit
Columns("D:D").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("O1").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("Sheet2").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet2").AutoFilter.Sort.SortFields.Add2 Key:= _
Range("O1:O58100"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet2").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Range("$A$1:$BK100000").AutoFilter Field:=15, Criteria1:= _
"Required"
ActiveSheet.Range("$A$1:$BK100000").AutoFilter Field:=28, Criteria1:= _
""

Range("AB1:AB" & lastRow).Offset(1, 0).SpecialCells(xlCellTypeVisible).Areas(1).Rows(1).Select

ActiveCell.FormulaR1C1 = "Completed"

Range("AB1:AB" & lastRow).Offset(1, 0).SpecialCells(xlCellTypeVisible).Areas(1).Rows(1).Select
Selection.filldown

End Sub

5 Replies

  • TP700 

    The instruction

     

    Range("AB1:AB" & lastRow).Offset(1, 0).SpecialCells(xlCellTypeVisible).Areas(1).Rows(1).Select

     

    selects a single cell. So there is nothing to fill down.

    • TP700's avatar
      TP700
      Copper Contributor
      What would I need to replace this with in order to make it fill down?

Resources