Okay, Yet More Macro Practice
I didn’t think I would, but I actually worked a little bit more on macro programming for that cryptography game/puzzle. This time I created a macro that would generate a list of 2 and 3 letter words, including nonsensical words. The 2 letter list doesn’t take to long to build but the 3 letter one does take a while to build. The list creation might be quicker if I had used formulas rather than macros. I will have to test that theory out.
It took me a while to generate the macro but the macro itself is really, really short and simple. The version shown below is for 3 letter words.
Create a list of words macro
Sub CreateWords()
‘
‘ Create words
‘
‘i = for first letter
‘j = for second letter
‘k = for third letter
‘nowords = number of words
Dim word As String
Dim firstletter As String
Dim secondletter As String
Sheets(“Create words”).Activate
nowords = 26 ^ 3
Count = 1
For i = 1 To 26
For j = 1 To 26
For k = 1 To 26
Cells(1 + Count, 6) = Cells(1 + i, 2) & Cells(1 + j, 2) & Cells(1 + k, 2)
Count = Count + 1
Next k
Next j
Next i
MsgBox (“Program is done”)
‘
End Sub
This post is going to be short because I need to spend time figuring out how to rebuild this website. The old theme became broken – I don’t know if it became broken during the last WordPress upgrade or somebody slipped in buggy codes. I’m going to have to spend time figuring out how I want my site and also learn how this new theme works.
You must be logged in to post a comment.