+ Reply to Thread
Results 1 to 4 of 4

Looping through the same task

  1. #1
    Registered User
    Join Date
    11-10-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Looping through the same task

    Edit: Looping*

    Hi everyone,

    I am using a macro to convert decimal numbers to a value with only two decimals.
    The macro I use is as follows:

    Please Login or Register  to view this content.
    The only problem is that when I make a large selection of cells (to the right of them), this macro will only work for the first one
    I have hundrends and thousands of such numbers.

    How do I make it convert them all?

    Ideally, if I could have just 1 button that converts every number on the sheet anywhere (such as 643.52652526) into exactly 643.53 (not just display rounding) that would be amazing. The sheet will also have strings that should not be converted, so that makes it more tricky (eg. some kind of IF statement on every single cell perhaps with a limit of 2000x2000 that if it's a decimal, convert it as above).
    But for now, just selecting and having the macro run through every number would be much better than what I currently have.

    Thanks!
    Last edited by JBeaucaire; 11-10-2012 at 01:42 PM. Reason: fixed the thread title (use GO ADVANCED button)

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Looping through the same task

    Hi, Neeve,

    maybe try this code on a copy of your worksheet:

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Last edited by JBeaucaire; 11-10-2012 at 01:43 PM.
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    11-10-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Looping through the same task

    Quote Originally Posted by HaHoBe View Post
    Hi, Neeve,

    maybe try this code on a copy of your worksheet:

    Please Login or Register  to view this content.
    Ciao,
    Holger
    This is amazing and does everything that I wanted, very elegant script!
    Thank you!
    Last edited by JBeaucaire; 11-10-2012 at 01:43 PM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Looping through the same task

    I have marked this thread solved for you.
    In the future please select Thread Tools from the menu above and mark the thread as solved. Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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