Jul 19 2021 02:00 PM
Hi everyone!
I know this is a straight forward answer but I am completely stumped! I will lay out my problem to best explain my issue:
In column C on my file, any cell in this col containing 0 is to have the file header copied to it and to stop when it hits the next empty row (end of my file).
I cannot seem to get this working in VBA for my macro and it is driving me insane.
Everything I have tried has come back with a error or has filled everyone single row with '0' and every empty row after my table which made my macro crash.
Currently what I have from a recorded macro however it has errors when run as these files all have a different number of rows.
Sub FillDown()
'
' FillDown Macro
'
'
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$Y$528").AutoFilter Field:=3, Criteria1:="0"
Selection.FillDown
ActiveSheet.Range("$A$1:$Y$528").AutoFilter Field:=3
End Sub
Oct 15 2021 04:47 AM
Do you want to process for example column D as it is shown in attached file? I wrote easy VBA code to perform this task. The "0" values are replaced by the column header until there is no entry left in column D.
Sub headline()
Dim i As Integer
For i = 2 To 100
If Cells(i, 4).Value = "" Then
Exit Sub
End If
If Cells(i, 4).Value = 0 Then
Cells(i, 4).Value = Cells(1, 4).Value
Else
End If
Next i
End Sub