當前位置:成語大全網 - 書法字典 - VBA詞典金額比較

VBA詞典金額比較

公共函數GetAmount(ByVal unit price As Single,_

?ByVal數量壹樣長,_

?ByRef AmountLen壹樣長,_

?可選ByVal精度為整數= 2,_

?可選ByVal currency unit Long =-27)As String()

Dim strAmount作為字符串

Dim strAmountArray()作為字符串

Dim strCurrencyUnit?作為字符串

Dim lngIndex As Long

strCurrencyUnit = ChrW$(貨幣單位)

strAmount = Replace(format number(unit price * Quantity,Precision)," ",vbNullString)

strCurrencyUnit & amp斯特拉蒙特

AmountLen = Len(strAmount)

ReDim strAmountArray(1到AmountLen)

對於lngIndex = 1到AmountLen

strAmount array(lngIndex)= Mid $(strAmount,lngIndex,1)

然後

GetAmount = strAmountArray()

結束功能

以第7行的計算為例。

子測試()

Dim strAmountArray()作為字符串

Dim lngAmountLen As Long

strAmountArray()= GetAmount(Range(" D7 "),Value2,Range("E7 "),Value2,lngAmountLen)。

範圍(“N7”)。偏移量(,-lngAmountLen + 1)。調整大小(,lngAmountLen)。Value = strAmountArray()

末端接頭

PS:批量計算請使用循環語句!