logo
Home
FREE DOWNLOADS
VBA Tutorials
VBA Code Samples
VBA Code - Excel
VBA for Beginners
Save Time on PC
SaveTimeWebsite
Save Time News
Save Time Blog
SaveTime SiteMap
Customer Service
Gibberish

Subscribe To
This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Add to Newsgator
Subscribe with Bloglines


The VBA Format Command

The VBA Format command is a function that takes an expression, a date or number value and converts it to a string according to your need. There are 4 arguments. The 3rd and 4th specify what you want considered the  1st day of the week and the first week of the year.

The first is an expression and the 2nd is the format. So for example...

Format(date, "yyyymmdd-hhnnss" would return the string...

20070709

Format(date, "mm/yyyy" would return...

07/2007


For numbers...

Format(7.5, "00.00") would return...

07.50

Format(7.5, "##.##") would return..

7.5


For hours use h (0-23) or hh for (01-23)

Use n or nn for minutes and s or ss for seconds. 








.





Return from The VBA Format Command to VBA Code Samples

Return to our Homepage


footer for Save Time page