lickrob
02-21-2013, 04:25 AM
I am trying to remove the spaces from numbers simmilar to this: 00 845 550 19 0007 0479 144
however when i run the below code on the cell i get this output.
8455501900070470000
Any Ideas
Dim strString As String
On Error GoTo Err
For Each cell In Selection.Cells
strString = cell.Value
strString = Replace(strString, " ", "")
cell.Value = strString
Selection.NumberFormat = "0"
Next
I have also tried:
MyCell.Value = Application.WorksheetFunction.Substitute(Trim(MyCell.Value), " ", "")
however when i run the below code on the cell i get this output.
8455501900070470000
Any Ideas
Dim strString As String
On Error GoTo Err
For Each cell In Selection.Cells
strString = cell.Value
strString = Replace(strString, " ", "")
cell.Value = strString
Selection.NumberFormat = "0"
Next
I have also tried:
MyCell.Value = Application.WorksheetFunction.Substitute(Trim(MyCell.Value), " ", "")