View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
deko[_3_] deko[_3_] is offline
external usenet poster
 
Posts: 62
Default Exporting to excel from Access

I think what's happening in my case is Excel is doing some kind of automatic
parsing on the data it receives via export from Access. Excel inserts the
leading apostrophe into cells it thinks should be text.

The use of a leading apostrophe in a cell is a common trick to force a cell
to be treated as text so Excel will not automatically apply date or number
formatting to that cell.

As far as I know, there's no way to prevent the Excel from doing this
automatic parsing when receiving data via export from Access. The leading
apostrophe must be removed from the cells after the data is in the
worksheet.

Sub RemoveApostrophe()
For Each CurrentCell In Selection
If CurrentCell.HasFormula = False Then
CurrentCell.Formula = CurrentCell.Value
End If
Next
End Sub

I found this code he
http://support.microsoft.com/default...;en-us;Q124739

This essentially does the same thing as Mr. Thomlinson's code.