edit M2
This commit is contained in:
@@ -428,3 +428,32 @@ Function Check12(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNum As Lo
|
||||
End If
|
||||
Check12 = True
|
||||
End Function
|
||||
|
||||
Function CheckDuplicate(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNum As Long, ByVal errorCol As String) As Boolean
|
||||
Dim checkValue As String: checkValue = Trim(ws.Cells(rowNum, colNum).Value)
|
||||
Dim letter As String: letter = ColLetter(colNum)
|
||||
Dim i As Long
|
||||
|
||||
For i = 7 To rowNum - 1
|
||||
If Trim(ws.Cells(i, colNum).Value) = checkValue Then
|
||||
ws.Cells(rowNum, errorCol).Value = GetErrorMsg("E010", letter & rowNum, checkValue)
|
||||
ws.Cells(rowNum, colNum).Interior.Color = RGB(255, 0, 0)
|
||||
CheckDuplicate = False
|
||||
Exit Function
|
||||
End If
|
||||
Next i
|
||||
|
||||
CheckDuplicate = True
|
||||
End Function
|
||||
|
||||
Function CheckNumber(ByVal ws As Worksheet, ByVal rowNum As Long, ByVal colNum As Long, ByVal varcharLength As Long, ByVal errorCol As String)
|
||||
Dim checkValue As String: checkValue = Trim(ws.Cells(rowNum, colNum).Value)
|
||||
If Len(checkValue) > varcharLength Then
|
||||
Dim letter As String: letter = ColLetter(colNum)
|
||||
ws.Cells(rowNum, errorCol).Value = GetErrorMsg("E011", letter & rowNum)
|
||||
ws.Cells(rowNum, colNum).Interior.Color = RGB(255, 0, 0)
|
||||
CheckVarcharOver = False
|
||||
Exit Function
|
||||
End If
|
||||
CheckVarcharOver = True
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user