Add row counter in export
This commit is contained in:
@@ -390,10 +390,15 @@ Sub ExportMasterDetailData()
|
|||||||
Dim csvContent As String
|
Dim csvContent As String
|
||||||
csvContent = CSV_HEADER & vbLf
|
csvContent = CSV_HEADER & vbLf
|
||||||
|
|
||||||
|
' Row counter
|
||||||
|
Dim rowCount As Long
|
||||||
|
rowCount = 0
|
||||||
|
|
||||||
' Data: C,G,H,I,J,K,L,M,N,O,P (skip D,E,F)
|
' Data: C,G,H,I,J,K,L,M,N,O,P (skip D,E,F)
|
||||||
Dim r As Long
|
Dim r As Long
|
||||||
For r = 7 To lastDataRow
|
For r = 7 To lastDataRow
|
||||||
If Len(Trim(ws.Cells(r, 3).Value & "")) > 0 Then
|
If Len(Trim(ws.Cells(r, 3).Value & "")) > 0 Then
|
||||||
|
rowCount = rowCount + 1
|
||||||
' CSV col1 -> C column
|
' CSV col1 -> C column
|
||||||
csvContent = csvContent & CleanCSVField(ws.Cells(r, 3).Value)
|
csvContent = csvContent & CleanCSVField(ws.Cells(r, 3).Value)
|
||||||
' CSV col2-11 -> G-P column
|
' CSV col2-11 -> G-P column
|
||||||
@@ -414,5 +419,5 @@ Sub ExportMasterDetailData()
|
|||||||
stream.SaveToFile savePath, 2
|
stream.SaveToFile savePath, 2
|
||||||
stream.Close
|
stream.Close
|
||||||
|
|
||||||
MsgBox "CSV export completed.", vbInformation
|
MsgBox "CSV export completed. Total rows: " & (rowCount + 1), vbInformation
|
||||||
End Sub
|
End Sub
|
||||||
Reference in New Issue
Block a user