Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Excel 2000 - VBA - Stop recordset Data from auto converting

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel 2000 - VBA - Stop recordset Data from auto converting

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.

--
Regards,
Tom Ogilvy


Matt. wrote in message
. ..
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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Excel 2000 - VBA - Stop recordset Data from auto converting

Thanks Tom.

I like the easy solutions.

cheers,
Matt.

"Tom Ogilvy" wrote in message
...
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.

--
Regards,
Tom Ogilvy


Matt. wrote in message
. ..
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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop converting (r) to ® excel 2007 Kevin Excel Discussion (Misc queries) 4 January 20th 09 12:46 AM
How do I stop Excel converting (R) to ®? NHS Paul Excel Discussion (Misc queries) 3 July 5th 07 04:37 PM
Two Questions: R1C1 and stop text number converting to data The Moose Excel Discussion (Misc queries) 5 October 31st 06 05:53 PM
How do I stop auto converting Text(Inventory#) to Dates DavidB Excel Discussion (Misc queries) 1 September 2nd 05 05:14 PM
Excel 2000 VBA recordset manipulation Matt. Excel Programming 2 September 16th 03 03:59 PM


All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"