Attribute VB_Name = "cast_roundCurr" '------------------------------------------------------------------------------- 'File : cast_roundCurr.bas ' Copyright mpl by ERB software ' All rights reserved ' http://wiki.yaslaw.info/dokuwiki/doku.php/vba/cast/roundCurr 'Environment : VBA 2007 + 'Version : 1.0.0 'Name : roundCurr 'Author : Stefan Erb (ERS) 'History : 05.01.2015 - ERS - Creation '------------------------------------------------------------------------------- Option Explicit ' roundedValue = roundCurr(value, precision) '/** ' * Währungsrunden. 5-Rappen Problem ' * @example Runden auf 5 Rappen: roundCurr(12.12, 0.05) ' * Runden auf 1 Franken: roundCurr(12.12, 1) ' * Runden auf 25 Rappen: roundCurr(12.12, 0.25) ' * @param Double Wert der gerundet werde soll ' * @param Double Genauigkeit ' * @return Double gerundeter Wert ' */ Public Function roundCurr(ByVal iValue As Double, ByVal iPrecision As Double) As Double roundCurr = Round(iValue / iPrecision, 0) * iPrecision End Function