I'd like to be able to set the display format of data for a cell (for example the caller cell) via a VBA function and I've found posts around the internet that seem to suggest it to be feasible and indeed it is feasible via a macro on a hardcoded cell (for example cell A1) but all my attempts to do it via a function (or a sub that the function calls) have failed. In my code I'm not getting any error, but apparently my setting of NumberFormat seems to be ignored. The fact that setting NumberFormat is ignored is not completely true because when in the string format I provide is present the percent character such as in "0.00%" the new NumberFormat is indeed applied but this is the only case where the thing works. I have also tried using the trick/workaround of invoking the evaluate function to call a sub that sets the NumberFormat for the desidered cell but it is not any more successful.
Below is an example code I used in one of the many attempts I made.
My Excel is a Microsoft 365 64-bit version. I specify it because I've found posts on the internet of people declaring that somehow the M365 version introduces further limitations compared to other or older versions of Excel.
Bookmarks