Forum Discussion
WorksheetFunction.Substitute fails on some cells but works on other cells in a column
This i the result when I run your macro using my default system settings (decimal separator = point).
Note that there are no points in column A anymore.
But if I set the decimal separator to comma, this is the result:
Note that several cells still contain a point, for example A3 and A4.
This is because those cells originally contained a number value, and the point is the thousands separator. Excel does not see the thousands separator as part of the value - it is merely part of the display. So that point is not replaced with a comma.
What is your decimal separator?
And can you provide some examples of the desired result?
I'm using Excel 16.47.1 on mac OS Catalina 10.15.7 in Italian. i.e European regional settings, where
we use "." as thousand separator and "," as decimal separator. I did not find any option to change
the separator type in Excel, it seems I have to change the Mac's regional settings and use Excel in English
to change how the separators behave, but that will mess up all my other Excel files.
The data I work on is downloaded from a bank in csv format then brought into the my workbook as query table.
Please see the attached file to see my results when I run the macro with my default European settings.
Column "A" has the results after running the macro, column "B" has my desired results and column "D" has the original data.
Column "A" shows some numbers stored as text even though I tried to convert them to numbers in my macro ?!?
How should I deal with the cells where, as you say, the point is not recognized ?
Thank you.
- HansVogelaarMar 25, 2021MVP
I'd change the regional settings to use point as decimal separator and comma as thousands separator.
Open the .csv file, then return the regional settings to their original values.