Code to Fill Blank Cells with Preceding Cell Value
Example-1
Sub FillBlankCellsFromAbove()
Application.ScreenUpdating = False
'Instead of Columns(1), we may use Range() also.
With Columns(1)
.SpecialCells(xlCellTypeBlanks).Formula = "=R[-1]C"
'Convert formulas into static values.
.Value = .Value
End With
Application.ScreenUpdating = True
End Sub
Example-2
Sub FillBlankCellsFromAbove2()
Columns(1).SpecialCells(xlCellTypeBlanks).Formula = "=R[-1]C"
Columns(1).Value = Columns(1).Value
End Sub
Comments
Post a Comment