Thursday, February 23, 2017

Add Random Data in Spreadsheet

To add random data in spreadsheet you can use macro code, advantage to use this no more manual work. Use below code to generate data.

Public Sub ran()
Dim b As Range
    For i = 1 To 800000
        Dim r As Double
        r = Int(Timer * Rnd())
        Cells(i, 20).Value = 0
        Cells(i, 21).Value = "USD"
        Cells(i, 22).Value = ""
        Cells(i, 23).Value = "A clever fox just jump over the lazy dog"
        Cells(i, 24).Value = r
    Next i
End Sub

Dynamic data generated in "r" variable and rest of data is static.

No comments:

Post a Comment

web stats