+ Reply to Thread
Results 1 to 6 of 6

need to convert details in entire sheet from text to number format

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-15-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    111

    need to convert details in entire sheet from text to number format

    Hi All ,

    I have data in couple of columns which are currently in text format. Need a macro code to automatically convert entire sheet details to number format.
    Please advise.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: need to convert details in entire sheet from text to number format

    No need for a macro.

    Highlight the entire range
    scroll back to the top-left corner
    right-click on the small green triangle
    select Convert text to numbers
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: need to convert details in entire sheet from text to number format

    Try

    Sub Convert()
    Dim Cell As Range
    Selection.NumberFormat = "General"
    For Each Cell In Selection
        Cell = Val(Cell)
    Next Cell
    End Sub
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007/2010.
    Martin

  4. #4
    Forum Contributor
    Join Date
    09-15-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    111

    Re: need to convert details in entire sheet from text to number format

    Hi Martin...
    Above code that you have given does not work ... And also please note I do not want to manually select the lines for conversion. So by default entire sheet have to be converted to Number format..


    Pease advise

  5. #5
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: need to convert details in entire sheet from text to number format

    It's works for me but maybe I set up my numbers in text format differently to you. Are you able to post a copy of the workbook?

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: need to convert details in entire sheet from text to number format

    Maybe:

    Sub aleanboyww()
    ActiveSheet.UsedRange.offset(1).NumberFormat = "0.00"
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA to convert cell to text and ensuring 7 digit number all along in entire column.
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-19-2013, 09:35 AM
  2. Convert date and time in serial number format to text format
    By nda13112 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2013, 02:45 PM
  3. [SOLVED] convert text-format number to number in excel 2000%3f
    By Larry in forum Excel General
    Replies: 1
    Last Post: 07-29-2005, 04:05 PM
  4. [SOLVED] How do I convert the format? (Please see msg for details)
    By Upendra Singhai in forum Excel General
    Replies: 2
    Last Post: 05-05-2005, 06:06 AM
  5. [SOLVED] Convert numbers from text format to number format
    By merlin68 in forum Excel General
    Replies: 4
    Last Post: 04-12-2005, 09:06 AM

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