+ Reply to Thread
Results 1 to 6 of 6

Convert text into numbers

  1. #1
    Registered User
    Join Date
    12-02-2016
    Location
    Stockholm
    MS-Off Ver
    2019
    Posts
    27

    Convert text into numbers

    Hi all,

    I've recorded a small macro that basically just formats an Excel-sheet into a format that I like to work with. The "raw" data is retrieved from a database. In this case Excel treats some data as text when it is actually numbers and I need to correct that. It is very easy to do manually but I would like my macro to do it for me. For some reason it's not possible to record this action and I can't seem to find a code snippet or other explanation that works for this particular issue.

    Any help on this would be greatly appreciated. I have attached an example.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: Convert text into numbers

    You probably need to set the copied data into the format you want.

    To set a column into a number format, you could use this kind a of code

    Please Login or Register  to view this content.
    or in the specific cell :
    Please Login or Register  to view this content.



    You'll need to look up the different possibilities in formatting.
    Even a little help can be a big help !!
    1. A sample workbook says more then words. Add problem description and solution so we can understand the problem.
    2. Your appreciation is accepted by clicking the star "Add Reputation" at the lower left of the post.
    3. If your problem is solved, mark it as [SOLVED]: See "FAQ : " https://www.excelforum.com/faq.php
    4. Use [CODE] [/CODE] tags to illustrate your code: see here

  3. #3
    Registered User
    Join Date
    12-02-2016
    Location
    Stockholm
    MS-Off Ver
    2019
    Posts
    27

    Re: Convert text into numbers

    Thanks for the tip, however it doesn't work in this case. It now shows as "Number" on a cell, but Excel still gives you the exclamation mark and says "Number stored as text".

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,636

    Re: Convert text into numbers

    Try
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-21-2009
    Location
    Belgium - Mechelen
    MS-Off Ver
    Office 365 - version 2310
    Posts
    278

    Re: Convert text into numbers

    jindon,

    you beat me to it

    This was the code i was going to upload.
    first is for the activecell , the other for a column.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-02-2016
    Location
    Stockholm
    MS-Off Ver
    2019
    Posts
    27

    Re: Convert text into numbers

    It works great, thanks for the support jindon and MarMo.

    //Fred

+ 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. VBA to convert a range from numbers to numbers stored as text (Text to Columns)
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-06-2017, 05:50 PM
  2. [SOLVED] Marco to convert numbers stored as text to numbers and dates stored as text to numbers
    By a2424 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-22-2014, 10:19 AM
  3. [SOLVED] Convert numbers stored as text to numbers for range of data that changes
    By excel2425 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-06-2014, 01:57 PM
  4. [SOLVED] Convert all numbers stored as text or custom formatted to numbers &no decimals - 40 sheets
    By synses in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2013, 01:46 AM
  5. [SOLVED] How do you apply the int() in VBA in order to convert numbers stored as text to numbers
    By djaurit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 02:57 PM
  6. Replies: 2
    Last Post: 10-22-2009, 02:50 PM
  7. Convert numbers stored as text to numbers Excel 2000
    By Darlene in forum Excel General
    Replies: 6
    Last Post: 01-31-2006, 04:10 PM

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