|
VAB编的公式,有时用到此公式的单元格全部自动变文本格式,导致公式无法自动计算,要全部用到此单元格的格式重新设置才会恢复。请老师看看什么问题,这种现像是偶尔会出现,只有这个公式会这样。我用的是excel2021版本
Function base_BH(nNum)
Application.Calculation = xlManual
nNump = ""
For i = 0 To 9
If InStr(nNum, i) > 0 Then nNump = nNump & i
Next
tx = "501 160 270 380 490"
zRC_Limt = Split(tx, " ")
pNum = ""
Select Case Len(nNump)
Case 1:
pNum = zRC_Limt((nNump) Mod 5)
Case 2:
Dim tmp(3)
For i = 1 To 2
For j = i + 1 To Len(nNum)
If Mid(nNum, i, 1) = Mid(nNum, j, 1) Then tmp(j) = 1
Next
Next
Dim Num(3)
For j = 1 To Len(nNum)
Num(j) = Mid(nNum, j, 1)
If tmp(j) = 1 Then Num(j) = (Mid(nNum, j, 1) + 5) Mod 10
Next
pNum = Num(1) & Num(2) & Num(3)
If Mid(nNump, 1, 1) Mod 5 = Mid(nNump, 2, 1) Mod 5 Then pNum = zRC_Limt(Mid(nNump, 1, 1) Mod 5)
Case 3:
pNum = nNum
End Select
base_BH = pNum
Application.Calculation = xlAutomatic
End Function
|
|