I wrote some simple code to go through a worksheet and Trim the contents of all the cells, like this:

For r = 1 To 100
For c = 1 To 10
Cells(r, c).Value = Trim(Cells(r, c).Value)
Next c
Next r


But some of the cells have numeric codes in them which contain hyphens.

The Trim function seems to have interpreted some of these hyphenated codes as dates, and it has automatically translated them into date format.
Is there a way to stop the Trim function from doing this?