Format Cells with VBA?

G

Gustaf

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
 
G

Gary''s Student

After you have completed the import into Excel, run:

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

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