+ Reply to Thread
Results 1 to 6 of 6

Round off selected range

  1. #1
    Registered User
    Join Date
    02-26-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Round off selected range

    Hi,
    I want to write a code where If I select a dynamic range for example A1 to A10, it applies the ROUND function and replace the value.
    For One cell I applied

    Please Login or Register  to view this content.
    But I want the code to work, If user selects some range of cells.
    Thanks for help.
    Last edited by vickey.narang; 12-23-2010 at 11:33 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Round off selected range

    Hi,

    Try something like this?
    Please Login or Register  to view this content.
    hth
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Round off selected range

    hi vickey.narang,

    dont forget to add code tags around your vba syntax; even for the small snipits

    thanks
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Round off selected range

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

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Round off selected range

    @jaslake, do not ignore Mods requests to OP when posting.

    On this occasion given it's Sunday I've modified for OP and left your post in tact.

    In terms of the question - you can also use Evaluate to avoid cell by cell iteration

    Please Login or Register  to view this content.
    so the above will process all cells within each cell area within active Selection simultaneously - verifying entries as numbers prior to rounding of course.

    you could apply SpecialCells(xlCellTypeConstants,xlNumbers) to further restrict the Ranges being itereated [and shorten Evaluate formula] but that brings with it a few extra requirements - Error Handler etc... and restriction re: # of non-contiguous ranges

  6. #6
    Registered User
    Join Date
    02-26-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Round off selected range

    Thank you guys
    its working very well.

+ 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