How to Generate Random Phone Numbers in Excel

One of the best things that Excel does is generating random numbers and repetition of formulas. All you have to do is to add a formula in a cell and replicate that formula in other cells. I am sure that most of the project managers love this tool because of the power of formulas and easiness of writing custom code for their requirements.

This post can be useful for people related to telecom marketing and obviously for the programming wizards who are always interested to solve some problems. In this post I am showing you how to generate random phone numbers in excel.

You can also set how many random phone numbers you want to generate and also how many digits you want in each phone number based on your country.


Sub random_phone_number()
Dim num As Integer
Dim dig As Integer
Dim str As Variant

Dim x
num = InputBox("How Many Random Phone Numbers You Want")
dig = InputBox("How Many Digits in a phone number you have in your country?")
For x = 2 To (num + 1) Step 1
'Set str = ""
 For y = 1 To dig Step 1
 str = str & Application.WorksheetFunction.RandBetween(1, 9)
Next y
Cells(x, 1).Value = str
str = ""
Next x
End Sub

Read More Post