add error cache2

This commit is contained in:
simple321vip
2026-04-20 21:39:53 +08:00
parent 14682d3504
commit 6f2bb324e4
4 changed files with 6 additions and 3 deletions

View File

@@ -281,7 +281,10 @@ private Function RunValidationSilent(ws As Worksheet, Optional ByRef errorCountO
errorCountOut = 0 errorCountOut = 0
For r = startRow To lastDataRow For r = startRow To lastDataRow
Application.Run validate, ws, r, lastDataRow Application.Run validate, ws, r, lastDataRow
If Trim(ws.Cells(r, errorCol).Value) <> "" Then Dim errorMessage As String : errorMessage = Trim(ws.Cells(r, errorCol).Value)
Dim errorCode As String: errorCode = GetCode(errorMessage)
If errorCode <> "W001" And errorCode <> "" Then
MsgBox errorMessage
errorCountOut = errorCountOut + 1 errorCountOut = errorCountOut + 1
End If End If
Next r Next r

View File

@@ -324,7 +324,7 @@ Function GetErrorMsg(ByVal errorCode As String, Optional ByVal param As String =
Dim errorList As Object: Set errorList = GetErrorList() Dim errorList As Object: Set errorList = GetErrorList()
Dim errorMessage As String Dim errorMessage As String
If errorList.Exists(errorCode) Then If errorList.Exists(errorCode) Then
errorMessage = Replace(errorList(errorCode)(0), "{0}", param) errorMessage = MakeSelect(errorCode, Replace(errorList(errorCode)(0), "{0}", param))
End If End If
GetErrorMsg = errorMessage GetErrorMsg = errorMessage
End Function End Function

View File

@@ -155,7 +155,7 @@ Private Sub Validate(ws As Worksheet, ByVal rowNum As Long, ByVal lastDataRow As
' Check if M2 uses this M1 kukan code ' Check if M2 uses this M1 kukan code
Dim m2Cache As Object: Set m2Cache = GetM2Cache() Dim m2Cache As Object: Set m2Cache = GetM2Cache()
If Not m2Cache.Exists(cValue) Then If Not m2Cache.Exists(cValue) Then
ws.Cells(rowNum, errorCol).Value = "The section details are not registered for the corresponding section" ws.Cells(rowNum, errorCol).Value = GetErrorMsg("W001", cValue)
ws.Range("C" & rowNum).Interior.Color = RGB(255, 128, 0) ws.Range("C" & rowNum).Interior.Color = RGB(255, 128, 0)
Exit Sub Exit Sub
End If End If