+ Reply to Thread
Results 1 to 3 of 3

Rounding in VBA

  1. #1
    Registered User
    Join Date
    11-19-2012
    Location
    Utah, USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Rounding in VBA

    I am generating random numbers within VBA that I would like to round up to the next whole number. I'm not using the worksheet. I would like to do this within the code. A solution is appreciated.

  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,197

    Re: Rounding in VBA

    Hi, Siegfried,

    you may use WorksheetFunction.RoundUp to round the random numbers or maybe even use WorksheetFunction.RandBetween for doing so.

    Ciao,
    Holger
    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-19-2012
    Location
    Utah, USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Rounding in VBA

    Holger, That works like a charm. Thank you so much.

    I am from Hamburg many years ago and have a cousin named Holger living in Hamburg. You're not my cousin are you? I visited my old neighborhood in Altona last year.

    Siegfried
    Last edited by Siegfried; 05-15-2013 at 01:56 AM.

+ 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