+ Reply to Thread
Results 1 to 6 of 6

RANDBETWEEN Excel Function in Macro

  1. #1
    Registered User
    Join Date
    12-14-2013
    Location
    Ukraine
    MS-Off Ver
    Excel 2013
    Posts
    25

    RANDBETWEEN Excel Function in Macro

    Hi there!
    I need some help or advice...
    I have a vb code below which generate numbers in desired cells according to the range provided in the code.
    Please Login or Register  to view this content.
    Code working well but when I'm clicking on the some cell from the range it show me formula (for instance: =RANDBETWEEN(45,65)) in the formula field even I've deleted the vb module.
    I need that formula will not appears any more after macro finished to run and all tables will be filled with the numbers. The best solution will be possibility to delete the macro after it ran and all numbers stay as is in the desired tables.
    Thank you in advance,
    Igor

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,799

    Re: RANDBETWEEN Excel Function in Macro

    If I understand correctly, you want the results to remain as hard coded values after the macro runs and not show up as formulas. Is this what you are looking to happen?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: RANDBETWEEN Excel Function in Macro

    Try to add below code after every select, this will replace formula with values..

    like after your code
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    or just put 1 line or code after all your code....
    ( select the full range)
    Please Login or Register  to view this content.
    Last edited by naveenmarapaka; 11-23-2014 at 10:38 AM.

  4. #4
    Registered User
    Join Date
    12-14-2013
    Location
    Ukraine
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: RANDBETWEEN Excel Function in Macro

    Quote Originally Posted by alansidman View Post
    If I understand correctly, you want the results to remain as hard coded values after the macro runs and not show up as formulas. Is this what you are looking to happen?
    Yep, this is correct!

    Try to add below code after every select, this will replace formula with values..

    like after your code...
    Just add after Selection.AutoFill.... Selection.Copy.... in each section, correct?

  5. #5
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: RANDBETWEEN Excel Function in Macro

    I suggest you 2nd option.. that's would be better... put the code just before End Sub

  6. #6
    Registered User
    Join Date
    12-14-2013
    Location
    Ukraine
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: RANDBETWEEN Excel Function in Macro

    Guys, thanks to both of you for replay as well as for fast and professional solution!!
    Last edited by igor7; 11-23-2014 at 11:23 AM.

+ 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. If and Randbetween Function
    By dr_phd1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2013, 04:02 PM
  2. RANDBETWEEN function capped
    By derek594 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-30-2013, 11:14 PM
  3. Randbetween Function
    By CV_GAS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2008, 03:45 PM
  4. Freezing the RANDBETWEEN function
    By zuri125 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-11-2008, 01:58 AM
  5. randbetween function
    By Tracey in forum Excel General
    Replies: 5
    Last Post: 02-10-2006, 08:35 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