I want to copy Barcode Code and Quantity data from the Excel sheet to a CSV file as:
101320,546
101330,330
101340,360
With the below codes:
Dim i As Long, lastrow As Long
' Sheet name is İrsaliye
lastrow = Sheets("İrsaliye").Range("C1000").End(xlUp).Row
For i = 23 To lastrow
Cells(i, "C").Copy
Cells(i, "I").Copy
Workbooks.Add
ActiveSheet.Paste
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\oguz\Desktop\csv\yourCSV.csv" _
, FileFormat:=xlCSV, CreateBackup:=False, Local:=True
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Next
It just takes last Quantity data 366 to csv file.
If I use below code line
Range("C23:C25").Copy
instead of
Cells(i, "C").Copy
It takes all the data from Barcode Codes to CSV but in this way I could not take quantities to CSV file.