I'm trying to create a CSV output file in VBA but I can't seem to get it. I need to loop through a spreadsheet and pull numbers from column 'I' based on whether column D has a "1" in it or not. Could someone please help with the syntax? I'd like to incorporate the following loop portion.
Dim iRow as Integer
'Loops through worksheet starting at row 2
For iRow = 2 To ActiveSheet.UsedRange.Rows.Count
'Determines whether there's a 1 in column D or not. If there is, copy the file number from row I
If Trim(range("D" & iRow)) <> "" Then
'insert code to pull file numbers from row I and then output it to a CSV file
End If