User Defined Functions (UDF) cannot change a worksheet, they can only return a value to the cell(s), in this case A1
You would need to use a Sub
The best alternative might be to use a Worksheet_Change event and that's not great
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iRow As Long
Dim r1 As Range
If Target.Column > 2 Then Exit Sub
Set r1 = Target.Cells(1, 1).CurrentRegion
With r1
If Target.Row > .Rows.Count Then Exit Sub
Application.EnableEvents = False
For iRow = 2 To .Rows.Count
If Len(.Cells(iRow, 2).Value) = 0 Then
Worksheets("Sheet2").Range(.Cells(iRow, 1).Value).ClearContents
Else
Worksheets("Sheet2").Range(.Cells(iRow, 1).Value).Value = .Cells(iRow, 2).Value
End If
Next iRow
Application.EnableEvents = True
End With
End Sub
Sheet1 has addresses and values to go onto Sheet2