Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Generate random password

Hi,

I would like to set up a macro/worksheet function that creates random
alphanumeric passwords for users of a database.
To hep me achieve this I have set up the following.
Starting at ColA2 I have a list of forenames and in ColB2 I have a list
of surnames. There are currently 120 users in my list. Would it be
possible to run a macro which picks up the first 2 initials of the
forename and surname and then for it to produce a random 4 digit pin
number and place the completed result as a password starting in ColC2.
For example, Mickey Mouse would become mimo1977.

The only drawback with the method is the simple logic that I am using.
Would it be possible to 'mix up' the initials so Mickey Mouse would
look like omni1977.

Maybe there is an easier way to do this without macros using worksheet
functions - I would welcome alternative solutions.

Grateful for a response

Many thanks

Tony

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Generate random password

Hi,
This will generate a random password of form AAAAnnnn. Enter =genpw()
into any cell.

Function GenPw()
Dim password As String
password = ""
For i = 1 To 4
password = password + Chr((Int(Rnd() * 26) + 65))
Next
password = password + Trim(Str(Int(Rnd() * 10000)))
GenPw = password
End Function


HTH

" wrote:

Hi,

I would like to set up a macro/worksheet function that creates random
alphanumeric passwords for users of a database.
To hep me achieve this I have set up the following.
Starting at ColA2 I have a list of forenames and in ColB2 I have a list
of surnames. There are currently 120 users in my list. Would it be
possible to run a macro which picks up the first 2 initials of the
forename and surname and then for it to produce a random 4 digit pin
number and place the completed result as a password starting in ColC2.
For example, Mickey Mouse would become mimo1977.

The only drawback with the method is the simple logic that I am using.
Would it be possible to 'mix up' the initials so Mickey Mouse would
look like omni1977.

Maybe there is an easier way to do this without macros using worksheet
functions - I would welcome alternative solutions.

Grateful for a response

Many thanks

Tony


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Generate random password

Hi Tony

Let me suggest that you keep your initials as they are. "Mimo" will be
better for Mickey Mouse than "miom" to remember.Then put some logic into the
number that you know and can reconstruct anywhere on paper, but that's not
obvious to the user.

A quick suggestion: Lowercase first two from forename & Lowercase first two
from surname & (ascii value of second letter in forename plus ascii value of
last letter in surname plus length of forename plus length og surname)

=LOWER(LEFT(A1,2))&LOWER(LEFT(B1,2))&CODE(UPPER(MI D(A1,2,1)))+CODE(UPPER(MID
(B1,2,1)))+LEN(A1)+LEN(B1)

Result
Mickey Mouse mimo163
Michael Moore mimo164

Replace some or all + with & and you have longer numbers

=LOWER(LEFT(A1,2))&LOWER(LEFT(B1,2))&CODE(UPPER(MI D(A1,2,1)))&CODE(UPPER(MID
(B1,2,1)))&LEN(A1)&LEN(B1)

Mickey Mouse mimo737965
Michael Moore mimo737975

Just ideas to play with. Those little things are fun to do.

Best wishes Harald

skrev i melding
oups.com...
Hi,

I would like to set up a macro/worksheet function that creates random
alphanumeric passwords for users of a database.
To hep me achieve this I have set up the following.
Starting at ColA2 I have a list of forenames and in ColB2 I have a list
of surnames. There are currently 120 users in my list. Would it be
possible to run a macro which picks up the first 2 initials of the
forename and surname and then for it to produce a random 4 digit pin
number and place the completed result as a password starting in ColC2.
For example, Mickey Mouse would become mimo1977.

The only drawback with the method is the simple logic that I am using.
Would it be possible to 'mix up' the initials so Mickey Mouse would
look like omni1977.

Maybe there is an easier way to do this without macros using worksheet
functions - I would welcome alternative solutions.

Grateful for a response

Many thanks

Tony



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Generate random password

Harald & Toppers,

Many thanks for the neat solutions - both meet my requirements.
I will use Harlad's worksheet function and advice as the generated
password will be slightly easier to remember for users.

Cheers
Tony

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
random generate team Gary Shelton Excel Discussion (Misc queries) 1 December 7th 09 04:17 PM
Generate random numbers cawhitaker Excel Discussion (Misc queries) 3 September 27th 07 09:01 PM
generate a random number and use if function to generate new data Dogdoc1142 Excel Worksheet Functions 4 April 26th 06 03:44 AM
How to generate random X given only min, max, mean? [email protected] Excel Discussion (Misc queries) 4 December 27th 05 06:20 AM
generate random numbers Jules Excel Worksheet Functions 6 November 2nd 04 05:57 PM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"