Last Updated on January 11, 2023 by token
1. Fix VBA function – Description
The Fix VBA function is used to round numbers, that have decimal places to integers. The Fix function, in comparision to the VBA Round function, does not require entering additional arguments. The result will always be an integer value.
Important information is, that for negative numbers, the VBA Fix function rounds the number up to zero. If you want to round the negative number down (further from zero value), you should use the VBA Int function.
2. VBA Fix function – Syntax
'officeinside.org Fix(Number)
Number: The number that you want to round.
Function return: Number / integer value.
3. VBA Fix function – Example
How to use the Fix function in Excel VBA? Examples of using the Fix function in the Visual Basic Editor are listed below.
Example 1: Example of using the Fix VBA function – result in the MsgBox window.
'officeinside.org MsgBox Fix(-9.25) MsgBox Fix(9.25)
Example 2: VBA Fix – example of a function – result in the Excel spreadsheet.
'officeinside.org Range ("A1") = Fix(-9.25) Range ("A1") = Fix(9.25)
4. VB Fix function – Additional information
- Fix function does not require additional arguments.
- For negative numbers, the function rounds number up to 0.
5. Fix VisualBasic function – Where to use?
The function can be used in: Excel 2003, Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel 365.
This article is part of the list of VBA Excel functions. A list of all VBA functions can be found at this address: Excel VBA functions.
One thought on “Fix VBA function – How to round negative numbers up”