<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Excel VB &#124; random password generator</title>
	<atom:link href="http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/feed/" rel="self" type="application/rss+xml" />
	<link>http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/</link>
	<description>official website of Simon Page</description>
	<pubDate>Thu, 11 Mar 2010 22:01:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: okili</title>
		<link>http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/#comment-348</link>
		<dc:creator>okili</dc:creator>
		<pubDate>Tue, 21 Jul 2009 22:08:34 +0000</pubDate>
		<guid isPermaLink="false">http://simoncpage.co.uk/blog/?p=133#comment-348</guid>
		<description>Thank you for your answer, now it works well. I have Excel 2007, not 2003, the randbetween function does work in Excel main window but it does not in VB Editor, I don't know why, probably something is wrong with installation. Fortunately the equivalent function does the same thing.
Now as I see I should have used Rnd() instead of just Rnd and another one is that I defined c as Integer (don't know why :D ) not as string.

So finally, to sum up:
We got the simple and smart function, with the following syntax: pass(Length); it chooses randomly symbols from the following ranges: A-Z, a-z, 0-9; and creates the password of the defined length :)</description>
		<content:encoded><![CDATA[<p>Thank you for your answer, now it works well. I have Excel 2007, not 2003, the randbetween function does work in Excel main window but it does not in VB Editor, I don&#8217;t know why, probably something is wrong with installation. Fortunately the equivalent function does the same thing.<br />
Now as I see I should have used Rnd() instead of just Rnd and another one is that I defined c as Integer (don&#8217;t know why :D ) not as string.</p>
<p>So finally, to sum up:<br />
We got the simple and smart function, with the following syntax: pass(Length); it chooses randomly symbols from the following ranges: A-Z, a-z, 0-9; and creates the password of the defined length :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Page</title>
		<link>http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/#comment-347</link>
		<dc:creator>Simon Page</dc:creator>
		<pubDate>Tue, 21 Jul 2009 12:22:21 +0000</pubDate>
		<guid isPermaLink="false">http://simoncpage.co.uk/blog/?p=133#comment-347</guid>
		<description>Take it you mean you only have Excel 2003 as Randbetween works fine in Excel 2007. The equivalent of this is:

INT(RAND()*(b-a)+a)

So looks like you are almost there, here it is with corrections:

Function pass(Length As Integer)

Dim p As String
Dim c As String

p = ""

For i = 1 To Length
    
    x = Int(Rnd() * 4)
    
    If x = 1 Then c = Chr(Int(Rnd() * (57 - 48) + 48))
    If x = 2 Then c = Chr(Int(Rnd() * (90 - 65) + 65))
    If x = 3 Then c = Chr(Int(Rnd() * (120 - 97) + 97))

    p = p &#038; c

Next i

pass = p

End Function</description>
		<content:encoded><![CDATA[<p>Take it you mean you only have Excel 2003 as Randbetween works fine in Excel 2007. The equivalent of this is:</p>
<p>INT(RAND()*(b-a)+a)</p>
<p>So looks like you are almost there, here it is with corrections:</p>
<p>Function pass(Length As Integer)</p>
<p>Dim p As String<br />
Dim c As String</p>
<p>p = &#8220;&#8221;</p>
<p>For i = 1 To Length</p>
<p>    x = Int(Rnd() * 4)</p>
<p>    If x = 1 Then c = Chr(Int(Rnd() * (57 - 48) + 48))<br />
    If x = 2 Then c = Chr(Int(Rnd() * (90 - 65) + 65))<br />
    If x = 3 Then c = Chr(Int(Rnd() * (120 - 97) + 97))</p>
<p>    p = p &#038; c</p>
<p>Next i</p>
<p>pass = p</p>
<p>End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: okili</title>
		<link>http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/#comment-346</link>
		<dc:creator>okili</dc:creator>
		<pubDate>Mon, 20 Jul 2009 17:43:45 +0000</pubDate>
		<guid isPermaLink="false">http://simoncpage.co.uk/blog/?p=133#comment-346</guid>
		<description>I tried to modify the function to get what I wanted but something went wrong, here is the code which i tried to use:

Function pass(Length As Integer)

Dim p As String
Dim c As Integer

p = ""

For i = 1 To Length
x = Int(Rnd * 2 + 1)
If x = 1 Then c = Chr(Int(48 + Rnd * (57 - 48)))
If x = 2 Then c = Chr(Int(65 + Rnd * (90 - 65)))
If x = 3 Then c = Chr(Int(97 + Rnd * (122 - 97)))
p = p &#38; c
Next i

pass = p

End Function</description>
		<content:encoded><![CDATA[<p>I tried to modify the function to get what I wanted but something went wrong, here is the code which i tried to use:</p>
<p>Function pass(Length As Integer)</p>
<p>Dim p As String<br />
Dim c As Integer</p>
<p>p = &#8220;&#8221;</p>
<p>For i = 1 To Length<br />
x = Int(Rnd * 2 + 1)<br />
If x = 1 Then c = Chr(Int(48 + Rnd * (57 - 48)))<br />
If x = 2 Then c = Chr(Int(65 + Rnd * (90 - 65)))<br />
If x = 3 Then c = Chr(Int(97 + Rnd * (122 - 97)))<br />
p = p &amp; c<br />
Next i</p>
<p>pass = p</p>
<p>End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: okili</title>
		<link>http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/#comment-345</link>
		<dc:creator>okili</dc:creator>
		<pubDate>Mon, 20 Jul 2009 17:41:03 +0000</pubDate>
		<guid isPermaLink="false">http://simoncpage.co.uk/blog/?p=133#comment-345</guid>
		<description>Unfortunately the randbetween function does not work for me (I have excel 2007)...</description>
		<content:encoded><![CDATA[<p>Unfortunately the randbetween function does not work for me (I have excel 2007)&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Page</title>
		<link>http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/#comment-287</link>
		<dc:creator>Simon Page</dc:creator>
		<pubDate>Mon, 13 Apr 2009 15:18:49 +0000</pubDate>
		<guid isPermaLink="false">http://simoncpage.co.uk/blog/?p=133#comment-287</guid>
		<description>Thanks David for that contribution!</description>
		<content:encoded><![CDATA[<p>Thanks David for that contribution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Z</title>
		<link>http://simoncpage.co.uk/blog/2008/08/18/excel-vb-random-password-generator/#comment-284</link>
		<dc:creator>David Z</dc:creator>
		<pubDate>Fri, 03 Apr 2009 17:01:18 +0000</pubDate>
		<guid isPermaLink="false">http://simoncpage.co.uk/blog/?p=133#comment-284</guid>
		<description>I wrote a fairly simple macro that uses upper &#38; lower case letters, numerals, and a few special characters (forcing one of each type).  Below is VBA for a 10-character password

&lt;code&gt;
Sub PasswordGenerate()
'Creates a password 10 characters long
'with at least 1 upper &#38; lower case letters, 1 number, and 1 special character
'
'Recorded by David Z, April 3, 2009
'
'
Dim l, x, c As Integer
Dim p, p1, p2 As String

p = ""

'Force at least one of each character type
    c = RandBetween(35, 38) 'Special characters #, $, %, &#38;
        p = p &#38; Chr(c)
    c = RandBetween(48, 57) 'Number
        p = p &#38; Chr(c)
    c = RandBetween(65, 90) 'Upper case
        p = p &#38; Chr(c)
    c = RandBetween(97, 122) 'Lower case
        p = p &#38; Chr(c)

'Create a string variable 6 characters long, randomizing characters, numbers, upper &#38; lower case letters
    For l = 1 To 6
        x = Empty 'Just in case
        x = RandBetween(1, 4) 'Choose a random number
            If x = 1 Then c = RandBetween(35, 38) 'Specials
            If x = 2 Then c = RandBetween(48, 57) 'Numbers
            If x = 3 Then c = RandBetween(65, 90) 'Uppers
            If x = 4 Then c = RandBetween(97, 122) 'Lowers
        p = p &#38; Chr(c) 'concatenate old password &#38; random character
    Next l

'Now randomly re-arrange the characters in the password string
x = RandBetween(0, 9)
    p1 = Left(p, x)
    p2 = Right(p, Len(p) - x)

p = p2 &#38; p1 'Password is ready!

Selection.Value = p

End Sub
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I wrote a fairly simple macro that uses upper &amp; lower case letters, numerals, and a few special characters (forcing one of each type).  Below is VBA for a 10-character password</p>
<p><code><br />
Sub PasswordGenerate()<br />
'Creates a password 10 characters long<br />
'with at least 1 upper &amp; lower case letters, 1 number, and 1 special character<br />
'<br />
'Recorded by David Z, April 3, 2009<br />
'<br />
'<br />
Dim l, x, c As Integer<br />
Dim p, p1, p2 As String</p>
<p>p = ""</p>
<p>'Force at least one of each character type<br />
    c = RandBetween(35, 38) 'Special characters #, $, %, &amp;<br />
        p = p &amp; Chr(c)<br />
    c = RandBetween(48, 57) 'Number<br />
        p = p &amp; Chr(c)<br />
    c = RandBetween(65, 90) 'Upper case<br />
        p = p &amp; Chr(c)<br />
    c = RandBetween(97, 122) 'Lower case<br />
        p = p &amp; Chr(c)</p>
<p>'Create a string variable 6 characters long, randomizing characters, numbers, upper &amp; lower case letters<br />
    For l = 1 To 6<br />
        x = Empty 'Just in case<br />
        x = RandBetween(1, 4) 'Choose a random number<br />
            If x = 1 Then c = RandBetween(35, 38) 'Specials<br />
            If x = 2 Then c = RandBetween(48, 57) 'Numbers<br />
            If x = 3 Then c = RandBetween(65, 90) 'Uppers<br />
            If x = 4 Then c = RandBetween(97, 122) 'Lowers<br />
        p = p &amp; Chr(c) 'concatenate old password &amp; random character<br />
    Next l</p>
<p>'Now randomly re-arrange the characters in the password string<br />
x = RandBetween(0, 9)<br />
    p1 = Left(p, x)<br />
    p2 = Right(p, Len(p) - x)</p>
<p>p = p2 &amp; p1 'Password is ready!</p>
<p>Selection.Value = p</p>
<p>End Sub<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
