Need to have below code modified. It removes all spaces inside specific worksheet (this time we call it "Paste Data") from all cells. It can be run from any other worksheets. I would like to have option to set a range only. For example it will remove all spaces from worksheet "Paste Data" from F10:L11. Any ideas?
Public Sub Remove_unwanted_spaces()
Dim sht As Worksheet
Dim fnd As Variant
Dim rplc As Variant
fnd = " "
rplc = ""
'Store a specific sheet to a variable
Set sht = Sheets("Paste DATA")
'Perform the Find/Replace All
sht.Cells.Replace what:=fnd, Replacement:=rplc, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
End Sub
Trim
function – Darrell H