Random Number Generator - Page 2
Thanks:  0
Likes:  0

1. ## Re: Random Number Generator

While we're nit picking, Rick your code will have a run time error if there are no blank cells in the target range.

2. ## Re: Random Number Generator

Originally Posted by JoeMo
While we're nit picking, Rick your code will have a run time error if there are no blank cells in the target range.
That is a good nit given it could be possible that the OP might not know if there are any blanks to be filled or not. Corrected code below...
Code:
```Sub FillBlanksWithRandomTempNumber()
Dim RandNum As Long, Cell As Range, Blanks As Range, Nums As String
On Error GoTo NoBlanks
For Each Cell In Range("A1", Cells(Rows.Count, "A").End(xlUp)).SpecialCells(xlBlanks)
Do
RandNum = Application.RandBetween(10000000, 99999999)
Loop While InStr(" " & Nums & " ", " " & RandNum & " ")
Nums = Nums & " " & RandNum
Cell.Value = "TEMP" & RandNum
Cell.EntireRow.Font.Color = vbRed
Next
NoBlanks:
End Sub

```

3. ## Re: Random Number Generator

If your gone fight, why not fight over this little problem I have.

https://www.mrexcel.com/forum/excel-...t-records.html

The one who sorts it can be the champ. lol

4. ## Re: Random Number Generator

Originally Posted by Sharid
If your gone fight, why not fight over this little problem I have.

https://www.mrexcel.com/forum/excel-...t-records.html

The one who sorts it can be the champ. lol
Fight? We don't fight, we just strive to give you the perfect solution to fit your need.

As for your little problem, you could improve your chances of getting help by posting some sample data that reflects what you start with and what you would like to see after the solution is applied, all in a format that can be copied from a browser and pasted to Excel. That would remove considerable labor and exchange of posts from the task of provision of a solution.

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•