Sub AwTest()
Dim i&, j%, x%, n%, y%, m%, arr, tempAr, tempBr, ar, br
[i2:i5000].ClearContents
arr = [a1].CurrentRegion
For i = 2 To UBound(arr)
n = 0
tempAr = Split(arr(i, 4), "#")
For x = 0 To UBound(tempAr)
If InStr(tempAr(x), "-") Then
ar = Split(tempAr(x), "-")
n = n + (ar(1) - ar(0) + 1)
Else
If Len(tempAr(x)) Then n = n + 1
End If
Next
If InStr(arr(i, 5), "、") Then
m = 0
tempBr = Split(arr(i, 5), "、")
For y = 0 To UBound(tempBr)
If InStr(tempBr(y), "-") Then
br = Split(tempBr(y), "-")
m = m + (br(1) - br(0) + 1)
Else
If Len(tempBr(y)) Then m = m + 1
End If
Next
Else
m = 1
End If
arr(i, 9) = m * n * arr(i, 6)
Next
[a1].CurrentRegion = arr
End Sub |