Advertisement
chengtie

Untitled

Dec 16th, 2021
1,506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub convertToNonNumbersAndClean()
  2.     Application.Calculation = xlCalculationManual
  3.     For Each cell In Selection.SpecialCells(xlCellTypeConstants)
  4.         x = CStr(cell.Value)
  5.         cell.ClearContents
  6.         cell.NumberFormat = "@"
  7.         cell.Value = x
  8.         If Left(x, 1) = "0" Then
  9.             x = Mid(x, 2, Len(x) - 1)
  10.         End If
  11.     Next
  12.     Application.Calculation = xlCalculationAutomatic
  13. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement