excels worksheet function trim removes all excess spaces from any string, prefix suffix and more than 1 between words
but is irrelevant for any other character

anhn's do loop will work to replace any number of any consequative characters, to a single character

note replace is not available in vb5 or vba in office 97

temp = Replace(String(7, "0"), "", , 1)
this would work if you got it right
vb Code:
  1. temp = "123400000005678"
  2. temp = Replace(temp, String(7, "0"), "")
  3. MsgBox temp
i tested to make sure vba excel 2000