Excel 2000 - VBA - Stop recordset Data from auto converting

M

Matt.

Hi all!

I'm importing some data from an Access recordset into Excel. I'm taking a
piece of the data in an Access field and putting into a cell. For example,
if the field contains "1265-1-2", I just want this Excel field to say "1-2".
However, when I write to the cell, the data is converted to Jan-02.

Here is the code I'm using to write the data:

Sheets("Daily").Cells(intDailyCount, 2).Value = Mid(rsProd("Job
#"), InStr(rsProd("Job #"), "-") + 1)
Sheets("Daily").Cells(intDailyCount, 2).HorizontalAlignment =
xlCenter

Everything is working fine. I can format the whole column if need be, but
I'd rather do it per cell.

cheers,
Matt.
 
T

Tom Ogilvy

Sheets("Daily").Cells(intDailyCount, 2).Value = "'" & Mid(rsProd("Job
#"), InStr(rsProd("Job #"), "-") + 1)

prepending a single quote will prevent this. the single quote won't be
visible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top