> In the quest to improve myself, any suggestions on better code?
Hi. Just some ideas.
There is no Dim statement for key5, so this suggest that you are not using
"Option Explicit" at the top of your module.
I suggest you turn this on going to Tools, Options, Editor Tab, and turn on
"Require Variable Declarations.
Key3 apparently is not used, and might be removed.
Although not required, you may want to load the array, instead of setting a
reference to the worksheet.
key1 = Range("D1:D96064")
> Dim Filename As String
> Filename = "C:\myTempDir\cashvalu.txt"
I like to combine these two into 1 statement.
Const Filename As String = "C:\myTempDir\cashvalu.txt"
"dur" is calculated on each loop, but may not be used depending on key5.
If you have a lot of blanks in Key5, this could be a "waste."
The 'Comma string is generated often.
Here's one of a few ideas.
Const Filename As String = "C:\myTempDir\cashvalu.txt"
Const Cm As String = "," 'Just a Comma
' etc...
For i = 1 To 96094
For j = 1 To 10
If Key5(i, j) <> vbNullString Then
Print #1, _
key1(i); Cm; _
key2(i); Cm; _
key4(i) + j - 1; Cm; _
Format(Key5(i, j) / 100, "0.00")
End If
Next j
Next i
Again, these are just some ideas. :>)

Signature
Dana DeLouis
> In the quest to improve myself, any suggestions on better code?
> I'm not interested in error trapping because this code will only be run by
[quoted text clipped - 31 lines]
> Close #1
> End Sub
Dana DeLouis - 25 Jan 2008 04:08 GMT
Oops! It's been a while.
Check if using "Write #" might be better than "Print #"
Sub Demo()
Const FileName As String = "C:\Junk.txt"
Open FileName For Output As #1
Print #1, 2; ","; 4; ","; 6
Write #1, 2, 4, 6
Close
End Sub
- -
Dana DeLouis
Brad - 25 Jan 2008 14:40 GMT
I caught the I didn't "Dim key5 ..."
Like the idea of the constants -
Thanks
> > In the quest to improve myself, any suggestions on better code?
>
[quoted text clipped - 76 lines]
> > Close #1
> > End Sub