|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
请参考
Function NQUYU(rng As Range, a, b, Optional n = 3, Optional m = 0)
Dim ar, i: ar = rng
If Not IsArray(ar) Then ReDim ar(1 To 1, 1 To 1): ar(1, 1) = rng Else ar = rng
For i = 1 To UBound(ar)
If ar(i, 1) <> "" Then
If CLng(ar(i, 1)) > CLng(a) - 1 And CLng(ar(i, 1)) < CLng(b) + 1 Then
ar(i, 1) = Format(Int((CLng(ar(i, 1)) - CLng(a)) * n / (CLng(b) + 1 - _
CLng(a))) & CLng(ar(i, 1)) Mod n, "00")
If m = 1 Then ar(i, 1) = Left(ar(i, 1), 1)
If m = 2 Then ar(i, 1) = Right(ar(i, 1), 1)
Else
ar(i, 1) = ""
End If
Else
ar(i, 1) = ""
End If
Next
NQUYU = ar
End Function
|
评分
-
3
查看全部评分
-
|