Hi,
When I retrieve a date type field from SQLServer and put it into Excel via VB it formats it in the number format. Anyone know the code to format it?
Printable View
Hi,
When I retrieve a date type field from SQLServer and put it into Excel via VB it formats it in the number format. Anyone know the code to format it?
It all depends on how you put it into Excel...
the easiest way is to put a single quote ( ' ) in front of the cell text, as Excel will treat it as text and not attempt to format it.
As said here before many times, if you're working with Excel and are not sure how to code something, start by recording a macro while manually doing what you want done [in your case formatting a cell]. Then just edit the macro to see the code for how it is done.