2016-05-23 3 views
0

Существует ли способ избежать получения округленного результата при использовании формулы vlookup в vba. Вот мой код:vlookup function rounding in vba

Sub test() 
Dim lastrow, pressurecolumn, lastcolumn As String, total As Integer, x, row, irow, column As Double 
lastrow = Range("B8").End(xlDown).Value + 7 

Range("Pump_design[Total Pipe losses from plantroom]").ClearContents 
For Each row In Columns("EZ") 
For irow = 8 To lastrow 
total = 0 
For column = 4 To 153 
x = Cells(irow, column).Value 
If Not IsEmpty(x) Then 
total = total + Application.WorksheetFunction.VLookup(x, Sheets("Pump Design").Range("Pump_design"), 154, False) 
End If 
Next column 
Cells(irow, "EZ") = Round(total, 4) 
If Cells(irow, "EZ") = 0 Then Cells(irow, "EZ").ClearContents 
Next irow 
row = irow + 1 
Next row 
End Sub 

ответ

0

Просто нашел трюк получить итог, как двойные вместо целого