+ Reply to Thread
Results 1 to 8 of 8

Marco to convert numbers stored as text to numbers and dates stored as text to numbers

  1. #1
    Registered User
    Join Date
    10-09-2012
    Location
    London
    MS-Off Ver
    Excel 365
    Posts
    78

    Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    Hi

    I need assistance in writing a macro to change numbers which are stored in an excel sheet as text to numbers and converting dates stored as text to numbers :

    I have attached a sample list of 18 rows, in reality the number of rows of data changes month to month so the marco would need to be able to work over different number of rows of data.

    column A the contract numbers are stored as text, i can convert them to numbers using the =value() formula can this be done in a marco.
    column B the start dates are stored as text in the following format 2012-07-01 00:00:00, i can convert them to dates using the following formula = datevalue(), can this be done in a marco?

    column C and E is the same as A

    column D is the same as B

    thanks for your helpexample.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    for macro you can do

    Please Login or Register  to view this content.
    Last edited by playaller; 05-21-2014 at 09:03 PM.


    Shelton A.
    If Helpful, Add Reputaion!

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    Hi a2424,

    Try this:

    Please Login or Register  to view this content.
    Lovely Autumn Sydney day isn't it!!

    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Registered User
    Join Date
    10-09-2012
    Location
    London
    MS-Off Ver
    Excel 365
    Posts
    78

    Re: Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    thank you for this very much! however I have noticed a problem, if there is a blank cell then the marco stops and an error shows with Run Time error 12 Type mismatch, how can I get the marco to run around the blank value

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    how can I get the marco to run around the blank value
    Like this:

    Please Login or Register  to view this content.
    Regards,

    Robert

  6. #6
    Registered User
    Join Date
    10-09-2012
    Location
    London
    MS-Off Ver
    Excel 365
    Posts
    78

    Re: Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    thanks a lot very good help!

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    You're welcome. Thanks for the feedback and marking the thread as solved

  8. #8
    Registered User
    Join Date
    06-20-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 365 ProPlus
    Posts
    15

    Re: Marco to convert numbers stored as text to numbers and dates stored as text to numbers

    Trebor76 I found this thread in search to the very thing you posted. I was able to use the code you provided but ran into a problem. I have values in the "A" column that are numbers and letters for example (0B, LL1, LL2, 6M) Using your code the letters disappear if they are after numbers for example (0B turns into 0) and (6M turns into 6) is there any way to adjust for this?

    Thanks for your time and help!!

+ 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] 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
  2. [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
  3. [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
  4. Replies: 2
    Last Post: 10-22-2009, 02:50 PM
  5. 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