Using Replace Programmatically to Set the Correct Range
Sub ReplaceExample()
Dim ws As Worksheet
Dim rg As Range
Dim lLastRow As Long
Set ws = ThisWorkbook.Worksheets("Replace Examples")
lLastRow = ws.Cells(65536, 1).End(xlUp).Row
Set rg = ws.Range(ws.Cells(2, 2), ws.Cells(lLastRow, 3))
rg.Replace "", "UNKNOWN"
Set rg = ws.Range(ws.Cells(2, 4), ws.Cells(lLastRow, 4))
rg.Replace "", "0"
Set rg = Nothing
Set ws = Nothing
End Sub
Related examples in the same category