Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I am teaching myself VBA. To learn how to write lopps I have challenged myself to do the following: A macro that cracks a password. I have a macro below, but please let me know if any of you can come up with a quicker way to search the various strings (beyond the obvious of "Application.ScreenUpdating = False"). So here is the challenge: In the workbook: Cell A1 contains the 7-digit password, say "eureka" (this is the password I want the macro to find) Cell A2 is blank (this is the cell I want the macro to test strings) Note: - This macro will look only for a 7-digit password, which password shall be in lower-case letters only (the lowercase alphabet = Chr(97) through Chr (122)) - This macro will also display the time the search begins and stops. Here is my first try at a macro to hack the password: _______________ Sub passwordsearch() ' ' 7 DIGIT SEARCH ' Dim a As Integer, b As Integer, c As Integer Dim d As Integer, e As Integer, f As Integer, g As Integer Dim Crack As String Range("a5").Value = "Start: " & Now() On Error Resume Next If Range("A2").Value < Range("A1").Value Then Do For a = 97 To 122: For b = 97 To 122: For c = 97 To 122 For d = 97 To 122: For e = 97 To 122: For f = 97 To 122: For g = 97 To 122 Crack = Chr(a) & Chr(b) & Chr(c) & Chr(d) & Chr(e) & Chr(f) & Chr(g) Range("A2").Value = Crack If Range("A2").Value = Range("A1").Value Then With Range("a6") ..Value = "Stop: " & Now() End With Exit Sub End If Next: Next: Next: Next: Next: Next: Next Loop End If End Sub ___________________ I launch this macro from a button on the worksheet. Any reccomendations are appreciated! -- Jason -- jasonsweeney ------------------------------------------------------------------------ jasonsweeney's Profile: http://www.excelforum.com/member.php...fo&userid=5222 View this thread: http://www.excelforum.com/showthread...hreadid=393619 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
What is the range finder and how do you use it? | Excel Discussion (Misc queries) | |||
Number Combination finder | Excel Worksheet Functions | |||
Rnage Finder | Excel Worksheet Functions | |||
Complex adjacent row value finder - need help | Excel Programming | |||
Password Loop question. | Excel Discussion (Misc queries) |