+ Reply to Thread
Results 1 to 11 of 11

Change and edit numbers in column with macro.

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Change and edit numbers in column with macro.

    Hi. I have below test sheet with numbers in Sheet 3 column D. They are pasted in from another application. I have tried solve this some time. But seems to be hard to make perfect.
    I need first to get the minus on the right side to the left side, with the numbers with minus.
    After that I need to change the format to number with dot as 1000 separator and comma. Now its the other way around and the format is general.
    I have tried many codes but it seems not so easy.
    Please take the time and have a look at the test sheet below. And see if you can help with this. I need a macro for it because its part of other sorting.

    Thanks in advance

    Sincerely
    Abjac
    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Change and edit numbers in column with macro.

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Change and edit numbers in column with macro.

    Hi John and thanks allot. I have tested it and its still not there. Many of the special minus numbers are in general format. And it cut the 2 zeroes after the comma.
    I need it to be correct because I need to be able to sort it after according to value.
    Please try with the sheet I uploaded. Paste the column D in to E so you can compare after.

    I have had and tried many solutions but so far no luck.

    If time please try with the test sheet here.

    Sincerely
    Abjac

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change and edit numbers in column with macro.

    How about this: ?

    Please Login or Register  to view this content.
    not the most elegant but should work?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Change and edit numbers in column with macro.

    HI Arkadi. I checked you macro and it first seems that it was great. But when I checked the format its in text.
    I have a problem I need to sort this after and I don't know why it don't display the correct result- Please try use ur macro and after sort column D. It don't sort it correct I think please have a look at that and what can be the reason. I would mean it should give me the higest minus amount first and down to the lowest minus amount after that the lowest plus amount and up. But its mixed.

    Please have a look and try in the sheet if you have time.

    Thanks in advance
    Sincerely
    Abjac

  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: Change and edit numbers in column with macro.

    Abjac - To change your decimal and thousands separators - Tools>Options>International>Uncheck use system separators and then edit the boxes.

  7. #7
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Change and edit numbers in column with macro.

    Hi. John and thanks its all ready like this.- Arkadi macro works i can calculate in it, but it done display all numbers with 2 digits after the comma. But please tell me why when i sort its all mixed .

    SIncerely
    Abjac
    Last edited by abjac; 10-16-2014 at 12:23 PM.

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change and edit numbers in column with macro.

    Abjac your sorting gets messed up because it is text instead of numbers, the "-" does not make text negative. However, the code below probably works fine... try this new version:

    Please Login or Register  to view this content.
    BUT!!!!: This will change excel's settings... do you want to keep it that way, or change it back to system settings? If so it can be done, we could convert your data back to text after sorting, and then revert to system separators.
    Last edited by Arkadi; 10-16-2014 at 12:35 PM.

  9. #9
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Change and edit numbers in column with macro.

    HI Arkadi. 5 Stars for this macro. I dont need to go back to system settings in fact, son in this case it dont mind. But i shall use it also at my work laptop, so if you have the code to get it back it would be great of course, then i can save it if i need to roll it back.
    But so far this code is brilliant really. I will wait to make this solved until you maybe can get the extended code to get it back again.,

    But so far really really great. Let me know if you have the extended one.

    Sincerely
    Abjac

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change and edit numbers in column with macro.

    abjac, sorry very busy today, but I will try to get you an updated code today or Monday.
    Buena suerte con el proyecto.

  11. #11
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change and edit numbers in column with macro.

    abjac, a quick question.... when data is formatted as text, sort didn't work. But, AFTER sorting, can we convert to text? I ask because if we change system settings back to default, the numbers would change back to , for thousands and . for decimals. If we convert to text after sorting, then they will stay the way we format them with the macro.

+ 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. Formula/macro to edit cells in one column based on contents of a cell in another column
    By robbyvegas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-25-2012, 06:10 AM
  2. [SOLVED] Edit existing macro to include week change
    By adamsurpren in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2012, 08:11 AM
  3. [SOLVED] VBA Question -- edit macro to add id numbers
    By saraereinosa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2012, 01:59 PM
  4. Replies: 11
    Last Post: 03-01-2012, 07:27 AM
  5. Replies: 0
    Last Post: 05-27-2010, 02:04 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