B
Brad
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 me.
Sub ExportCashValues()
Dim Filename As String
Dim Numrows As Long
Dim i As Long
Dim j As Long
Dim dur As Long
Dim data As Double
Dim key1 As Range
Dim key2 As Range
Dim key3 As Range
Dim key4 As Range
Set key1 = shtCash.Range("d1:d96064")
Set key2 = shtCash.Range("e1:e96064")
Set key3 = shtCash.Range("g1:g96064")
Set key4 = shtCash.Range("h1:h96064")
Set key5 = shtCash.Range("j1:s96064")
Filename = "C:\myTempDir\cashvalu.txt"
Open Filename For Output As #1
For i = 1 To 96094
For j = 1 To 10
dur = key4(i) + j - 1
If key5(i, j) <> "" Then
data = key5(i, j) / 100
Print #1, key1(i); ","; key2(i); ","; dur; ","; Format(data,
"0.00")
End If
Next j
Next i
Close #1
End Sub
I'm not interested in error trapping because this code will only be run by me.
Sub ExportCashValues()
Dim Filename As String
Dim Numrows As Long
Dim i As Long
Dim j As Long
Dim dur As Long
Dim data As Double
Dim key1 As Range
Dim key2 As Range
Dim key3 As Range
Dim key4 As Range
Set key1 = shtCash.Range("d1:d96064")
Set key2 = shtCash.Range("e1:e96064")
Set key3 = shtCash.Range("g1:g96064")
Set key4 = shtCash.Range("h1:h96064")
Set key5 = shtCash.Range("j1:s96064")
Filename = "C:\myTempDir\cashvalu.txt"
Open Filename For Output As #1
For i = 1 To 96094
For j = 1 To 10
dur = key4(i) + j - 1
If key5(i, j) <> "" Then
data = key5(i, j) / 100
Print #1, key1(i); ","; key2(i); ","; dur; ","; Format(data,
"0.00")
End If
Next j
Next i
Close #1
End Sub