Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Remove apostrophe's from worksheet

238 views
Skip to first unread message

Peter

unread,
Mar 4, 2004, 12:51:07 PM3/4/04
to
I have a spreadsheet that has several columns with numbers as text (apostrophe in front of number). I want to remove the apostrophe (') but not the format. Ex. '0045 to 0045. Also not to reformat dates.

Thanks
Peter


Dave Peterson

unread,
Mar 4, 2004, 9:13:53 PM3/4/04
to
Not quite sure what should have to the format. But something like this may get
you started:

Option Explicit
Sub testme()

Dim myCell As Range

For Each myCell In Selection.Cells
With myCell
If .PrefixCharacter = "'" Then
.NumberFormat = "@"
.Value = myCell.Value
End If
End With
Next myCell

End Sub


But I formatted the cell as Text ("@"). Maybe you wanted "0000".

Select the cells first, then run this macro. (do it against a copy or don't
save it when you close--if it screws up your data).

--

Dave Peterson
ec3...@msn.com

0 new messages