So what happens if you don't have values in every cell of the top row of your
usedrange, as you will get 0s and references to cells at the bottom of the
sheet. If that is not an issue however, then try this:-
Sub FillBlanks()
Dim LCol As Long
Dim ColNum As Long
Dim Rng As Range
Dim Cel As Range
Application.ScreenUpdating = False
LCol = ActiveSheet.UsedRange.Column - 1 + _
ActiveSheet.UsedRange.Columns.Count
For ColNum = 1 To LCol
On Error Resume Next
Set Rng = Intersect(ActiveSheet.UsedRange, Columns(ColNum), _
Cells.SpecialCells(xlCellTypeBlanks))
For Each Cel In Rng
Cel.FormulaR1C1 = "=R[-1]C"
Next Cel
Next ColNum
Application.ScreenUpdating = True
End Sub
This leaves the formulas in there though. If you want the data hardcoded, then
amend to:-
Sub FillBlanks()
Dim LCol As Long
Dim ColNum As Long
Dim Rng As Range
Dim Cel As Range
Application.ScreenUpdating = False
LCol = ActiveSheet.UsedRange.Column - 1 + _
ActiveSheet.UsedRange.Columns.Count
For ColNum = 1 To LCol
On Error Resume Next
Set Rng = Intersect(ActiveSheet.UsedRange, Columns(ColNum), _
Cells.SpecialCells(xlCellTypeBlanks))
For Each Cel In Rng
Cel.FormulaR1C1 = "=R[-1]C"
Next Cel
With Columns(ColNum)
.Copy
.PasteSpecial Paste:=xlValues
End With
Next ColNum
Range("A1").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
If you only want this done for cells between the first and last entry in each
column, then try this:-
Sub FillBlanks()
Dim LCol As Long
Dim ColNum As Long
Dim Rng As Range
Dim Cel As Range
Application.ScreenUpdating = False
LCol = ActiveSheet.UsedRange.Column - 1 + _
ActiveSheet.UsedRange.Columns.Count
For ColNum = 1 To LCol
On Error Resume Next
FrstRow = ActiveSheet.Cells(1, ColNum).End(xlDown).Row
LastRow = ActiveSheet.Cells(Rows.Count, ColNum).End(xlUp).Row
Set ColRng = Range(Cells(FrstRow, ColNum), Cells(LastRow, ColNum))
Set Rng = Intersect(ColRng, Columns(ColNum), _
Cells.SpecialCells(xlCellTypeBlanks))
For Each Cel In Rng
Cel.FormulaR1C1 = "=R[-1]C"
Next Cel
With Columns(ColNum)
.Copy
.PasteSpecial Paste:=xlValues
End With
Next ColNum
Range("A1").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub