update Master_M1_Kukan
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
' ============================================================
|
||||
' Generic Master Common Functions
|
||||
' ============================================================
|
||||
|
||||
Sub Generic_Master_ClearRowData(ByVal ws As Worksheet, ByVal rowNum As Long)
|
||||
ws.Range(ws.Cells(rowNum, 4), ws.Cells(rowNum, 15)).ClearContents
|
||||
ws.Cells(rowNum, 2).ClearContents
|
||||
End Sub
|
||||
|
||||
Sub Generic_Master_Import(ByVal ws As Worksheet, ByVal expectedColumnCount As Long)
|
||||
Dim filePath As String
|
||||
Dim lines As Variant
|
||||
@@ -23,7 +17,7 @@ Sub Generic_Master_Import(ByVal ws As Worksheet, ByVal expectedColumnCount As Lo
|
||||
lines = ReadCSVAs2DArrayStrict(filePath, expectedColumnCount, "utf-8")
|
||||
|
||||
' Step 3: Clear data rows
|
||||
Call ClearDataRows(ws, 7, 3)
|
||||
Call Generic_ClearDataRows(ws, 7, 3)
|
||||
|
||||
' Step 4: Import data
|
||||
writeRow = 7
|
||||
@@ -89,4 +83,13 @@ Sub Generic_Master_Export(ByVal ws As Worksheet, ByVal expectedColumnCount As Lo
|
||||
Call WriteCSVFromArray(savePath, dataArray, "utf-8", True)
|
||||
|
||||
MsgBox "CSV export completed. Total data rows: " & rowCount, vbInformation
|
||||
End Sub
|
||||
|
||||
Sub Generic_ClearDataRows(ByVal ws As Worksheet, ByVal startRow As Long, ByVal columnNum As Long)
|
||||
Dim lastRow As Long
|
||||
lastRow = ws.Cells(ws.Rows.Count, columnNum).End(xlUp).Row
|
||||
|
||||
If lastRow >= startRow Then
|
||||
ws.Range(ws.Cells(startRow, 1), ws.Cells(lastRow, 20)).ClearContents
|
||||
End If
|
||||
End Sub
|
||||
Reference in New Issue
Block a user