LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Help speeding up my code

Hi guys, I've written some code that finds four letter words that don't
have repeating letters (ex: Foot wouldn't count, two O's) The problem
is that it takes a long time to generate them all. Below is my code, if
anyone wants to take a look at it and suggest performance tweaks that'd
be great. If you have a different method/approach to getting the list
of 4 letter words that might be faster I'd like to hear that too.

Sub TotalRebuild()
GoodToGo = MsgBox("This will rebuild the whole wordlist, and it takes a
Long time, over 10 minutes. Are you sure?", vbOKCancel, "Warning, this
takes forever")

If GoodToGo = vbCancel Then End

Application.ScreenUpdating = False
'Application.WindowState = xlMinimized
'Application.Visible = False

Range("A:A").ClearContents 'clear column A so we can put the words in

For One = 65 To 90 'Set up loop for the first letter
o = Chr(One) ' variable o holds first letter

For Two = 65 To 90 'set up loop for second letter
t = Chr(Two) ' variable t holds second letter

For Three = 65 To 90 'set up loop for third letter
r = Chr(Three) 'variable r holds third letter

For Four = 65 To 90 'set up loop for fourth letter
f = Chr(Four) 'variable f holds fourth letter
dupe = 0 'reset duplicate variable
If o = t Then dupe = 1 ' if letters repeat, then
dupe = 1
If o = r Then dupe = 1
If o = f Then dupe = 1
If t = r Then dupe = 1
If t = f Then dupe = 1
If r = f Then dupe = 1

If dupe = 0 Then ' if no leters repeat, then put
the letters together
word = o & t & r & f

If Application.CheckSpelling(word) = True Then
' spellcheck the word
rw = rw + 1 'increment what row we put the
word in
Cells(rw, 1) = word 'put the word in the
row rw, column 1
End If

End If

Next Four

Next Three

Next Two

Next One

'Application.Visible = True
'Application.WindowState = xlMaximized
Application.ScreenUpdating = True

MsgBox "Done"

End Sub

 
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
speeding up copy and paste code cereldine[_18_] Excel Programming 1 April 20th 06 05:36 PM
Need help speeding this up KD[_5_] Excel Programming 0 March 24th 06 05:17 PM
Help on cleaning / speeding up code Chris Salcedo Excel Programming 2 October 17th 05 01:16 AM
Speeding Up Code [email protected] Excel Programming 8 August 31st 05 04:46 PM
Online Resources for Speeding Up Code orekin Excel Programming 1 July 8th 04 04:09 AM


All times are GMT +1. The time now is 05:25 PM.

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"