With any text value, I can individually format each character and then copy that formatting to another cell by iterating over the Range.Characters()
Collection.
However, if the cell is a number (even if the numberFormatting displays it as a string e.g. dates) then it does not expose a .Characters()
property and, indeed, cannot be selectively formatted digit-by-digit.
Why does Excel display strings using Character objects but not numbers, even when the number is being displayed as a string?
If you want to go around this, you may do the following:
In cell A1 put '123456 with the " ' " sign in front. Then write
range("A1").Characters(1,3).Font.Bold = true
It would take only the first three numbers, not taking into account the " ' " sign. Thus, the number is kind of displayed as a string, but you can still use it calculations e.g. A1 + 4 would give 123460.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With