+ Reply to Thread
Results 1 to 3 of 3

Round function in the same range

Hybrid View

HerryMarkowitz Round function in the same... 12-15-2013, 03:46 PM
mikerickson Re: Round function in the... 12-15-2013, 04:06 PM
HerryMarkowitz Re: Round function in the... 12-15-2013, 04:44 PM
  1. #1
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,014

    Round function in the same range

    Hi vba experts,
    I have following macro enclosed file.
    Sub Macro1()
    Sheets("Sheet1").Range("A2:J2").FormulaR1C1 = "=ROUND(R[-1]C,1)"
    Sheets("Sheet1").Range("A2:J2").Copy
    Sheets("Sheet1").Range("A1:J1").PasteSpecial Paste:=xlPasteValues
    End Sub
    Macro above is okey for me but I want to improve it.
    I want same thing but new macro will not be use A2:J2 range.
    In other words every process will be only in the A1:J1 range.

    Best wishes.
    Attached Files Attached Files
    Last edited by HerryMarkowitz; 12-15-2013 at 05:08 PM.
    Sub DontForgetThese()
         If Your thread includes any code Then Please use code tags...
         If Your thread has been solved Then Please mark as solved...
         If Anybody has helped to you Then Please add reputation...
    End Sub

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Round function in the same range

    Try
    Dim oneCell as Range
    
    For Each oneCell in Range("A1:J1")
        With oneCell
            .Value = WorksheetFunction.Round(Val(CStr(.Value)), 1)
        End Wiht
    Next oneCell
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,014

    Re: Round function in the same range

    Solved.
    Thank you mikerickson.
    Sub Macro1()
    Dim oneCell As Range
    For Each oneCell In Range("A1:J1")
        oneCell.Value = WorksheetFunction.Round(oneCell.Value, 1)
    Next oneCell
    End Sub
    Last edited by HerryMarkowitz; 12-15-2013 at 05:04 PM.

+ 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] If Statement with a Divisible-By function and Round Function
    By thanhie in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-06-2013, 01:00 AM
  2. [SOLVED] Conditional Round up or Round up Function
    By cdmterence in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-18-2013, 06:03 PM
  3. Problem Inserting Round function into an IF function
    By Ash87 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-11-2013, 05:37 PM
  4. [SOLVED] VB Function Round vs Excel function Round not behaving the same Od
    By Bud in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2006, 12:45 AM
  5. [SOLVED] How can I apply the ROUND function to a range of cells in a workbo
    By Ellemarr in forum Excel General
    Replies: 5
    Last Post: 06-10-2005, 09:05 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