Merhaba,
aşağıdaki kod ile parçalara böldüğüm dosyayı csv dosyası olarak katdetmiyor. Sanki txt dosya gibi kaydediyor. 24 sütunlu sayfadan herhangibir satırını örnek olarak ekledim.
Kullandığım kod aşağıda :
Yardım rica ediyorum
aşağıdaki kod ile parçalara böldüğüm dosyayı csv dosyası olarak katdetmiyor. Sanki txt dosya gibi kaydediyor. 24 sütunlu sayfadan herhangibir satırını örnek olarak ekledim.
15,X012025000007202,eArchive,Nihai,Nihai Nihai Nihai Nihai Müşteri,11111111111,76.09,0,76.09,0,0,0,0,0,69.17,6.92,0,0,0,0,7.31.2025,16:46,Nihai Nihai Nihai Nihai Nihai Müşteri,PAV860016430 |
Kullandığım kod aşağıda :
Kod:
Sub SplitWorkbookToCSV()
Dim srcWs As Worksheet
Dim newWb As Workbook
Dim chunkSize As Long: chunkSize = 500
Dim lastRow As Long
Dim startRow As Long, endRow As Long
Dim partIndex As Long
Dim baseName As String, folderPath As String, filePath As String
Set srcWs = ThisWorkbook.Sheets(1)
lastRow = srcWs.Cells(srcWs.Rows.Count, "A").End(xlUp).Row
If lastRow = 0 Then
MsgBox "Veri bulunamadı!", vbExclamation
Exit Sub
End If
baseName = Left(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, ".") - 1)
folderPath = ThisWorkbook.Path
If Right(folderPath, 1) <> "\" Then folderPath = folderPath & "\"
Application.ScreenUpdating = False
Application.DisplayAlerts = False
partIndex = 0
For startRow = 1 To lastRow Step chunkSize
partIndex = partIndex + 1
endRow = startRow + chunkSize - 1
If endRow > lastRow Then endRow = lastRow
Set newWb = Workbooks.Add(xlWBATWorksheet)
srcWs.Rows(startRow & ":" & endRow).Copy _
Destination:=newWb.Sheets(1).Rows(1)
filePath = folderPath & baseName & "_" & _
Format(partIndex, "00") & ".csv"
newWb.SaveAs Filename:=filePath, _
FileFormat:=xlCSV, _
CreateBackup:=False
newWb.Close SaveChanges:=False
Next startRow
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "Toplam " & partIndex & " dosya oluşturuldu.", vbInformation
End Sub