Fix remaining function calls
This commit is contained in:
@@ -81,7 +81,7 @@ Sub Z1_ImportMasterDetailData()
|
|||||||
If Trim(lines(i)) = "" Then GoTo NextCsvLine
|
If Trim(lines(i)) = "" Then GoTo NextCsvLine
|
||||||
dataArray = Split(lines(i), ",")
|
dataArray = Split(lines(i), ",")
|
||||||
If UBound(dataArray) >= 0 Then
|
If UBound(dataArray) >= 0 Then
|
||||||
code = CleanCSVField(CStr(dataArray(0)))
|
code = Z1_CleanCSVField(CStr(dataArray(0)))
|
||||||
If code <> "" Then
|
If code <> "" Then
|
||||||
' Use unique key: code + "_" + row index to avoid duplicate key error
|
' Use unique key: code + "_" + row index to avoid duplicate key error
|
||||||
csvData.Add code & "_" & i, dataArray
|
csvData.Add code & "_" & i, dataArray
|
||||||
@@ -104,13 +104,13 @@ NextCsvLine:
|
|||||||
dataArray = Split(lines(i), ",")
|
dataArray = Split(lines(i), ",")
|
||||||
|
|
||||||
' CSV col1-7 -> C-I column (3-9)
|
' CSV col1-7 -> C-I column (3-9)
|
||||||
wsTarget.Cells(writeRow, 3).Value = CleanCSVField(CStr(dataArray(0)))
|
wsTarget.Cells(writeRow, 3).Value = Z1_CleanCSVField(CStr(dataArray(0)))
|
||||||
wsTarget.Cells(writeRow, 4).Value = CleanCSVField(CStr(dataArray(1)))
|
wsTarget.Cells(writeRow, 4).Value = Z1_CleanCSVField(CStr(dataArray(1)))
|
||||||
wsTarget.Cells(writeRow, 5).Value = CleanCSVField(CStr(dataArray(2)))
|
wsTarget.Cells(writeRow, 5).Value = Z1_CleanCSVField(CStr(dataArray(2)))
|
||||||
wsTarget.Cells(writeRow, 6).Value = CleanCSVField(CStr(dataArray(3)))
|
wsTarget.Cells(writeRow, 6).Value = Z1_CleanCSVField(CStr(dataArray(3)))
|
||||||
wsTarget.Cells(writeRow, 7).Value = CleanCSVField(CStr(dataArray(4)))
|
wsTarget.Cells(writeRow, 7).Value = Z1_CleanCSVField(CStr(dataArray(4)))
|
||||||
wsTarget.Cells(writeRow, 8).Value = CleanCSVField(CStr(dataArray(5)))
|
wsTarget.Cells(writeRow, 8).Value = Z1_CleanCSVField(CStr(dataArray(5)))
|
||||||
wsTarget.Cells(writeRow, 9).Value = CleanCSVField(CStr(dataArray(6)))
|
wsTarget.Cells(writeRow, 9).Value = Z1_CleanCSVField(CStr(dataArray(6)))
|
||||||
|
|
||||||
writeRow = writeRow + 1
|
writeRow = writeRow + 1
|
||||||
NextLine:
|
NextLine:
|
||||||
@@ -119,7 +119,7 @@ NextLine:
|
|||||||
MsgBox writeRow - 7 & " rows imported.", vbInformation
|
MsgBox writeRow - 7 & " rows imported.", vbInformation
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Function Z1_CleanCSVField(ByVal field As Variant) As String
|
Function Z1_Z1_CleanCSVField(ByVal field As Variant) As String
|
||||||
If IsEmpty(field) Or IsNull(field) Then
|
If IsEmpty(field) Or IsNull(field) Then
|
||||||
CleanCSVField = ""
|
CleanCSVField = ""
|
||||||
Exit Function
|
Exit Function
|
||||||
@@ -137,7 +137,7 @@ Function Z1_CleanCSVField(ByVal field As Variant) As String
|
|||||||
CleanCSVField = result
|
CleanCSVField = result
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Sub Z1_validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long)
|
Sub Z1_Z1_validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long)
|
||||||
' Check C column - must be 3-digit alphanumeric, required
|
' Check C column - must be 3-digit alphanumeric, required
|
||||||
Dim cValue As String
|
Dim cValue As String
|
||||||
cValue = Trim(ws.Cells(rowNum, 3).Value)
|
cValue = Trim(ws.Cells(rowNum, 3).Value)
|
||||||
@@ -250,7 +250,7 @@ Sub Z1_validateDetailDataButton()
|
|||||||
|
|
||||||
errorCount = 0
|
errorCount = 0
|
||||||
For r = 7 To lastRow
|
For r = 7 To lastRow
|
||||||
Call Z1_validateDetailData(ws, r)
|
Call Z1_Z1_validateDetailData(ws, r)
|
||||||
If Trim(ws.Cells(r, 2).Value) <> "" Then
|
If Trim(ws.Cells(r, 2).Value) <> "" Then
|
||||||
errorCount = errorCount + 1
|
errorCount = errorCount + 1
|
||||||
End If
|
End If
|
||||||
@@ -300,10 +300,10 @@ Sub Z1_ExportMasterDetailData()
|
|||||||
If Len(Trim(ws.Cells(r, 3).Value & "")) > 0 Then
|
If Len(Trim(ws.Cells(r, 3).Value & "")) > 0 Then
|
||||||
rowCount = rowCount + 1
|
rowCount = rowCount + 1
|
||||||
' CSV col1 -> C column
|
' CSV col1 -> C column
|
||||||
csvContent = csvContent & CleanCSVField(ws.Cells(r, 3).Value)
|
csvContent = csvContent & Z1_CleanCSVField(ws.Cells(r, 3).Value)
|
||||||
' CSV col2-11 -> I-R column
|
' CSV col2-11 -> I-R column
|
||||||
For j = 9 To 18
|
For j = 9 To 18
|
||||||
csvContent = csvContent & "," & CleanCSVField(ws.Cells(r, j).Value)
|
csvContent = csvContent & "," & Z1_CleanCSVField(ws.Cells(r, j).Value)
|
||||||
Next j
|
Next j
|
||||||
csvContent = csvContent & vbLf
|
csvContent = csvContent & vbLf
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user