+ Reply to Thread
Results 1 to 6 of 6

Macro using "ROUND" function.

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    7

    Macro using "ROUND" function.

    Hi All,

    I have the problem in using the function "ROUND" in macro.

    Example:
    In excel
    1.5-----> ROUND(1.5,0)====> 2

    But while using macro,

    1.5-----> ROUND(1.5,0)====> 1

    For other values, macro works fine.

    My VBA code:

    For j = 3 To (a + 3)
    C = Range("B" & j).Value
    ActiveCell.Value = Round(C, 0)
    ActiveCell.Offset(1, 0).Select
    Next j


    Could anyone help me plz???

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Macro using "ROUND" function.

    Untested, but you could try this.

    ActiveCell.Formula = Round(C, 0)
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    08-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Macro using "ROUND" function.

    Quote Originally Posted by oeldere View Post
    Untested, but you could try this.

    ActiveCell.Formula = Round(C, 0)
    Thank you for your idea.
    But this also remians the same problem which i posted earlier.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Macro using "ROUND" function.

    another guess

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Macro using "ROUND" function.

    Quote Originally Posted by oeldere View Post
    another guess

    Please Login or Register  to view this content.
    This also not working!!!

  6. #6
    Registered User
    Join Date
    08-16-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Macro using "ROUND" function.

    Atlast I found the solution!!!!
    ActiveCell.Value = Round(C, 0) is changed as ActiveCell.Value = Application.Round(C, 0)
    Now its working fine.
    I think that we can use this as "ActiveCell.Value = WorksheetFunction.Round(C, 0)"

    Thank you all!!!

+ 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] Help to Remove "Round" function from formula
    By RMXByker in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-13-2013, 08:36 AM
  2. [SOLVED] How do I use the "if" and "round" function in the same formula ?
    By carl in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-27-2006, 11:45 AM
  3. [SOLVED] How can I round a number to the nearest "50" or "100" in excel 200
    By moi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 11:05 AM
  4. [SOLVED] How can I round a number to the nearest "50" or "100" in excel 200
    By moi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 AM
  5. [SOLVED] How can I round a number to the nearest "50" or "100" in excel 200
    By Manny in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM

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