+ Reply to Thread
Results 1 to 9 of 9

Macro - Convert stored text to number

  1. #1
    Registered User
    Join Date
    04-04-2012
    Location
    worcester
    MS-Off Ver
    Excel 2007
    Posts
    41

    Macro - Convert stored text to number

    Hello Again,

    My macro currently pulls in information from an SQL database but when it does that, all the numbers in column A need "converting to number".

    Is there a way to convert all cells in column A to number as a part of my macro?

    Currently I have to go to the error checking box and click "convert to number".

    Thanks for any help!

    Adam

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    Adam

    What macro?

    You haven't posted any code.
    If posting code please use code tags, see here.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Macro - Convert stored text to number

    Just use Text To Column>>Delimited>>Next>>Under Delimiters Don't Check any thing>>Next>>Finish.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    04-04-2012
    Location
    worcester
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: Macro - Convert stored text to number

    Hi I didn't post any code because I would just want the macro that would convert text to numbers to add onto the end of my code.

    I can convert it using text to column etc but that is a manual input...it needs to be automated...

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Macro - Convert stored text to number

    Just use Record Macro and select the column and follow the steps then you will get the piece of code and add that piece in your code.

  6. #6
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Macro - Convert stored text to number

    Hi..

    You could do this..

    If you have no blank rows in A..

    Please Login or Register  to view this content.
    or this..

    This is just automating the task of paste special - Multiply by 1..
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-04-2012
    Location
    worcester
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: Macro - Convert stored text to number

    thanks the last one would be better as it will have blanks in...what do you mean "multiply by 1"?

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro - Convert stored text to number

    Untested, try it

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Macro - Convert stored text to number

    Hi..

    One way of converting text to numbers is to do this:

    1. Type the number 1 in a cell.
    2. Right click on that cell and copy.
    3. Highlight your cells that you want converted..
    4. Right Click > Paste Special> Select Multiply

    So the code i gave you is just automating that..

+ 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