
For example, if you were rounding the number 328.25 and input “-1” here, it would round you number to 330.

In other words, numbers that contain decimal points are converted to numbers that contain decimal commas. In the process of doing this, Excel re-evaluates the contents of each cell and converts it to the appropriate numeric value. Then, it sets the value of each cell in the range equal to itself. This macro defines a range that consists of all the cells that contain constants. After you enter the number 1 4/8, Excel will automatically convert this value to the form of the smallest denominator (1 1/2).

The workaround is not to use find and replace, but to use a different trick. Excel converts a simple fraction to the lowest denominator. Click Options (Excel 2010 to Excel 2016), or the Microsoft Office Button > Excel Options (Excel 2007).In the Advanced category, under Editing options For example, type 100 in the cell if the numbers contain two decimal places and you want to convert them to whole numbers. Because American Excel expects the decimal separator to be a period, interpreting a "number" in VBA with another separator (such as a comma) will cause Excel to consider the value to be text. Round a number to the decimal places I want top.

The reason for this behavior is that Excel VBA "speaks" American, and some actions done using a recorded macro don't work as expected due to that fact. If there is no decimal or only single decimal places, it will pad zero behind the decimal point. If there are more than 2 decimal places in your float number, it will round off to 2 decimal places. Use float.ToString () to display a float value to 2 decimal places. However, when she recorded a macro that did the find and replace, the resulting cells were treated as text instead of as numeric values. Formatting a float value to 2 decimal places in C. She would do a find and replace, and everything would work fine. When she would receive a worksheet that showed numbers formatted with decimal points, she would need to convert the values so they used decimal commas, consistent with how numbers are displayed in Holland. Saskia was having a problem converting information, under the control of a macro, and still having it be usable in Excel.
