johnkrenkel
New Member
- Joined
- Apr 2, 2019
- Messages
- 11
I am trying to filter through a bunch of data and write information to a csv. it is functioning correctly with one exception, i keep writing over the first line so i never get all the data. I am certain it is a simple fix that I am overlooking to get to a new line in the csv file.
here is the relevant pc of code
here is the relevant pc of code
Code:
For Each cel In rng.Cells
item_in_review = cel.Value ' Name
EPIC_YES = cel.Offset(0, 1).Value 'Epic YES
If EPIC_YES = "Yes" Then '
For Each cel2 In rng2.Cells
'Match This
acct_string = cel2.Offset(0, 19).Value 'AcctName
date_string2 = cel2.Offset(0, 17).Value 'SettDateOfTran
'Output This
ret_code = cel2.Offset(0, 14).Value 'Return Code
id_num = cel2.Offset(0, 2).Value ' IdNum
tran_code = cel2.Offset(0, 6).Value 'Tran Code
If item_in_review = acct_string And Settlement = date_string2 Then
myfile = "C:\Test\" & currdate & "\Test-" & item_in_review & currdate & ".csv"
FileNumber = FreeFile
Open myfile For Output As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FileNumber]#FileNumber[/URL]
Write [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FileNumber]#FileNumber[/URL] , id_num, ret_code, tran_code
Close [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FileNumber]#FileNumber[/URL]
End If
Next cel2
End If
Next cel