VBA replace all blank cells within a range..


Sub ReplaceBlanks()

    'Set the range for which you want to fill the empty cells
    CellRange = "A1:D500"

    'Stop if all the cells are empty
    If WorksheetFunction.CountA(Range(CellRange)) = 0 Then

       MsgBox "All cells are empty", vbOKOnly

       Exit Sub

    End If
    
    'Replace the empty cells by the word "Blank"
    On Error Resume Next

    Range(CellRange).SpecialCells(xlCellTypeBlanks) = "Blank"

    On Error GoTo 0

End Sub