O'Reilly logo

Excel 2010 Financials Cookbook by Andre Odnoha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting dates with code

Financial data usually contains dates; however, date formats are not standard between applications, worksheets, or countries. It is often necessary to make modifications to the date format in order to expedite analysis and adhere to local formatting standards.

In this recipe, you will learn to create an add-in that will allow you to quickly change the date format of a selection of dates within your financial data.

How to do it...

We will begin this recipe by adding code to the Excel worksheet:

  1. In the worksheet that you wish to add the add-in, press Alt + F11 to open the visual basic editor (VBE).
  2. Once open, from the toolbar choose Insert | Module, to insert a blank code module:
  3. Enter the following code:
    Sub DateConvert() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required