Please help to solve the problem of resetting attributes and highlighting the entire text when using a formula (UDF) on the same sheet. It looks like a bug.
The attached example is specially designed for the problem being solved and is presented in a simplified form.
bug-highlight-substrings.ods (19.5 KB)
When calling the Module1.HIGHLIGTH_ALL_ONE_BY_ONE() function from the sheet on which the data is located, both resetting the font color in the range (oRange.CharColor = -1) and highlighting a text fragment with color, if this fragment is collectively equal to the entire string (that is, the concatenation of substrings makes up the entire string or the desired substring corresponds to the entire string) does not work.