|
▼大学一年生 さん:
こんな感じですか?
Sub TEST()
Debug.Print Num_Proc("III", "2V×4.1II×1.1III×10IV×2I")
End Sub
Function Num_Proc(CN As String, sType As String) As Double
Dim vD As Variant
Dim vF As Variant
Dim i As Long
Dim dD As Double
Dim strD As String
Dim sVi As Long
vD = Split(sType, "×")
If UBound(vD) = 0 Then Exit Function
dD = 1
sVi = 99999
For i = 0 To UBound(vD)
strD = CStr(Val(vD(i)))
If Replace(vD(i), strD, "") = CN Then sVi = i
If i >= sVi Then dD = dD * Val(vD(i))
Next
If sVi = 99999 Then dD = Val(vD(UBound(vD)))
Num_Proc = dD
End Function
|
|