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

Popular posts from this blog

Power Automate - Automatically fetch data from Power BI in to Excel and Send the copy of the Excel file via Email

Separate Text (Characters) & Numbers from Alpha Numeric String Using Formula and Macro (VBA)

File System Object