Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Formatting from CopyFromRecordset

I have a strange problem. I am using CopyFromRecordset to paste some
data from a database, then formatting the data. The first column
includes a date, so it comes in as a Julian value, then I format it to
mm/dd/yyyy. This is on Sheet1. Then, I use CopyFromRecordset for
another select statement and put it in Sheet2. It also has a date in
the first column. At this point, the first column of Sheet1, only
where the range overlaps with Sheet2, changes format to m/d/yyyy. The
header row and unpopulated rows still have the mm/dd/yyyy format.

Searching forums, I found this problem that sounds similar. Any ideas
as to why using CopyFromRecordset on one sheet would affect a
different sheet in the same workbook?
http://www.experts-exchange.com/Prog..._24760549.html

A snippet of the code looks like this: (a different sheet is activated
during the process)
Set rsResult = cmDB.Execute
shtHours.Range("A2").CopyFromRecordset rsResult
shtHours.Range("A:A").NumberFormat = "mm/dd/yyyy"
shtHours.UsedRange.Columns.AutoFit
sql=yadayada
cmDB.CommandText = sql
Set rsResult = cmDB.Execute
shtGas.Range("A2").CopyFromRecordset rsResult
shtGas.Range("A:A").NumberFormat = "mm/dd/yyyy"

shtHours is the sheet that gets the "m/d/yyyy" format in column A.
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
CopyFromRecordSet changes cell formatting Gunman69 Excel Programming 0 May 12th 06 07:41 AM
CopyFromRecordset Ernst Guckel[_4_] Excel Programming 3 May 1st 05 08:03 PM
CopyFromRecordset does nothing Hafeez Excel Programming 2 August 13th 04 07:20 PM
CopyFromRecordset does nothing E Harris Excel Programming 5 January 8th 04 04:29 PM
Copyfromrecordset Bug ? news.btx.dtag.de Excel Programming 1 August 1st 03 07:44 PM


All times are GMT +1. The time now is 01:50 AM.

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"