When there has been a change to A1, the code executes and removes any spacing in A1, change the cell addres to whatever cell you want.

This code goes in the worksheet module,right click the sheet tab, select View Code, paste the code here.

Private Sub Worksheet_Change(ByVal Target As Range)

    Dim Strg As String

    If Target.Address = "$A$1" Then
        Strg = Replace(Target, " ", "")
     Target = Strg
    End If
    
End Sub