Do the numbers need to be a consistent number of digits? Like 10000 through 99999, or does it matter/are they different?
Basically, you need to determine what the minimum number would be and what the maximum number would be, then use the formula . Now if the random generated number has to be unique (not appearing elsewhere in the sheet), this can only be done with vba code, which it seems you are wanting to use anyway. Assuming the button you want to click replaces all existing values in columns A and B that are the same as the selected value with a new random, non-duplicated number between that number range, the code would look like this:
Bookmarks