Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Format Cells with VBA?

In my Excel app, I load and save data to/from Access, using VBA/ADO code. Loading dates from Access is problematic. I get 39448 rather than 2008-01-01. I can change it manually with Format Cells and pick the short date format, but how would you do that in VBA? Do I have to set the data type for each cell? Setting it beforehand for the whole column doesn't seem to work.

Gustaf
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Format Cells with VBA?

After you have completed the import into Excel, run:

Sub Macro1()
Columns("A:A").NumberFormat = "yyyy-mm-dd"
End Sub

--
Gary''s Student - gsnu2007h


"Gustaf" wrote:

In my Excel app, I load and save data to/from Access, using VBA/ADO code. Loading dates from Access is problematic. I get 39448 rather than 2008-01-01. I can change it manually with Format Cells and pick the short date format, but how would you do that in VBA? Do I have to set the data type for each cell? Setting it beforehand for the whole column doesn't seem to work.

Gustaf

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 format cells in Excel 2007 (i.e. currency format)? DonR Excel Discussion (Misc queries) 2 May 25th 08 11:16 PM
how do i format a cell based on format of a range of cells? Chris Hardick Excel Discussion (Misc queries) 2 April 3rd 06 08:54 AM
want format cells alignment not format cells font style Jeannie Bean Excel Discussion (Misc queries) 2 February 10th 06 09:31 AM
Cells won't convert to number format, even after format/cells/num. scottr Excel Discussion (Misc queries) 5 April 12th 05 11:02 PM
When I select "format cells", the format dialog box does not disp. Andy S. Excel Worksheet Functions 2 November 23rd 04 03:49 AM


All times are GMT +1. The time now is 12:58 AM.

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

About Us

"It's about Microsoft Excel"