VBA to populate blank cells Hi, I am trying to understand VBA but it is a slow p
ID: 3560740 • Letter: V
Question
VBA to populate blank cells
Hi, I am trying to understand VBA but it is a slow process
How do I change this macro
Sub HTH()
Dim RowNo As Long, LastRow As Long
With Worksheets(1)
LastRow = .Range("B" & Rows.Count).End(xlUp).Row
Do
Set c = .Columns(1).Find("", after:=.[A2], LookIn:=xlValues)
If c Is Nothing Or c.Row > LastRow Then Exit Do
c.Value = c.Offset(-1).Value
Loop
End With
End Sub
So that blank cells in colum F will be populated with the same value as the last cell with text
Thanks
Explanation / Answer
.Try:"
Sub FillBlanksFromAboveInColumnF()
Dim FirstRowWithDataInColumnF As Long, LastRowWithDataInColumnF As Long, Addr As String
FirstRowWithDataInColumnF = 1
LastRowWithDataInColumnF = Cells(Rows.Count, "F").End(xlUp).Row
Addr = "F" & FirstRowWithDataInColumnF & ":F" & LastRowWithDataInColumnF
On Error Resume Next
Range(Addr).SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
On Error GoTo 0
Columns("F").Value = Columns("F").Value
End Sub
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.