Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to format cells in Excel 2007 (i.e. currency format)? | Excel Discussion (Misc queries) | |||
how do i format a cell based on format of a range of cells? | Excel Discussion (Misc queries) | |||
want format cells alignment not format cells font style | Excel Discussion (Misc queries) | |||
Cells won't convert to number format, even after format/cells/num. | Excel Discussion (Misc queries) | |||
When I select "format cells", the format dialog box does not disp. | Excel Worksheet Functions |