Randomised Number

R

Ravi Sandhu

Hi guys

I am having a problem working this out.

I need to programme a word or excel document, to have a randomly generated
reference number each time it opens.

Also, each time I open the file, I need for it to have 100 different print
outs. (The file is the same, just 100 different reference numbers)

Also, I want to be able to set parametres for the reference number. (i.e.
when I open it in five minutes it prints out a 100 copies of this file, with
ref AB001 - AB100, and next time I open it, it prints out AB101 to AB200)

I hope someone can help with this

Regards
 
F

Frank Isaacs

For the random number, this code will provide an integer between 1 and 100:

int(100*rnd())

As for the printouts, check the PrintOut method. You'd need to loop through
100 times to get the different sequence number to print; something like the
following (untested) code should do:

Sub RepeatPrint()
Dim x As Integer
For x = 1 To 100
Sheets(1).Range("A1") = "AB" & x
Sheets(1).PrintOut
Next
End Sub
--
HTH -

-Frank
Microsoft Excel MVP
Dolphin Technology Corp.
http://vbapro.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top