+ Reply to Thread
Results 1 to 3 of 3

Macro to change number format of cell values

  1. #1
    Forum Contributor
    Join Date
    03-03-2007
    Posts
    101

    Macro to change number format of cell values

    Hi. Has anyone every encountered this problem: You receive an Excel spreadsheet that has all the cells formatted as GENERAL. The cells contain numbers, but the format of those number values is not really NUMBER. Therefore, these values fail to calculate in mathematical and lookup formulas. So to fix it, you have to place your cursor in the cell and click ENTER in order to refresh the cell. Then, the format of the value within the cell converts to NUMBER, and your formulas start to work.

    Please see my attached spreadsheet. Is there a macro that can convert the values in column A to DATE, and the values in column B to NUMBER?

    I know of a trick using the COPY PASTE SPECIAL VALUES - MULTIPLY by 1.0 method, but I was wondering if the process could be more automated with a macro.

    Any advise is greatly appreciated.
    Attached Files Attached Files
    Last edited by Sean Anderson; 08-10-2007 at 01:21 PM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Macro to change number format of cell values

    You have more than one format in each column...
    General in the upper section and Text in the lower section

    Not a macro, but this is pretty quick....

    Select the 2-col range of cells
    [Ctrl]+[Shift]+~........a shortcut to convert the cells to General format

    Select the Col_A values
    <data><text-to-columns>
    Click [Next] until Step 3 of 3
    Check: Date....YMD.......Click [Finish]
    (That converts them to dates)

    Select the Col_B values
    <data><text-to-columns>
    Click [Next] until Step 3 of 3
    Check: General.......Click [Finish]
    (That makes the values numbers)

    Done (you may want to format the date cells)

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Contributor
    Join Date
    03-03-2007
    Posts
    101
    Thanks, it helped me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1