View Single Post
  #19   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
external usenet poster
 
Posts: 703
Default Three Letter List

Below:

"Ron Coderre" wrote:

Not to pick on anybody in particular, but
I cringe when I see code with:
- Undeclared variables


How do you know they were undeclared? The code submitted was a "snippet."
I figured readers could declare (or not) their own variables.

- Cryptic variables (declared or not)


i, j, k, real cryptic for loop counters. Long Live "For i = 1 To 10"

- Hardcoded references


if you're referring to Range("A1"), once again, snippet (example). At least
according to the OP's request it will work, whereas Selection.Cells(1, 1)
might not.

- Unnecessary range selections


you may win on this one. FTR, I didn't select the cells I activated them.
Maybe you can explain the difference. I don't know the answer to this one.

- and no error traps if there's a risk of crashing


how do you know there wasn't an error trap set? Snippet, remember? Let me
go back and review the snippet for a "risk of crashing"... Nope, I see none.

But thanks for the critique. :)


--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"Charlie" wrote in message
...
Several slick methods here. I thought yours was the simplest, cleanest.
I
shortened it even more and it ran in about one second.

Application.ScreenUpdating = False
Range("A1").Activate

For i = 65 To 90
For j = 65 To 90
For k = 65 To 90
ActiveCell = Chr(i) & Chr(j) & Chr(k)
ActiveCell.Offset(1, 0).Activate
Next k
Next j
Next i

Application.ScreenUpdating = True


"Gary''s Student" wrote:

Sub ThreeLetter()
l = 1
For i = 65 To 90
x = Chr(i)
For j = 65 To 90
y = Chr(j)
For k = 65 To 90
z = Chr(k)
Cells(l, 1).Value = x & y & z
l = l + 1
Next
Next
Next
End Sub

--
Gary''s Student - gsnu200777