I can reproduce the described mis(?)behaviour with V 22.214.171.124RC, and would see it as a bug.
However, the code has too many flaws (expectable malfunctioning) anyway.
The “ActiveCell” is a VBA concept, and it’s basically different from the
CurrentSelection as handled by the LibO API. Only if you can assure that no additional cells (or ranges) can be selected, the CurrentSelction of a spreadsheet document will return the active cell (the cell currently having the keyboard focus) as
CurentSelection even if it not is actually selected.
If cells or ranges are selected, the focused cell can be an additional cell not selected and highlighted itself, but only visualized by a frame around the cell’s area. After having selected cells or ranges, you can give the focus to an additional cell by Ctrl+Click once and a second time on the same cell. You can also Ctrl+Click on a previously selected cell and this way put the focus on it and remove it from the selection at the same time.
If you actually want advice how to get a specific representation of the current focus-cell, please edit your question telling so.
If you want to wait for a bugfix, report the bug to https://bugs.documentfoundation.org/ . Stay aware of the fact that the no-single-cell-selection will cause an error anyway with your code.
Generally: Don’t think Excel-VBA if you want to program in Basic for LibreOffice Calc. If you insist on the usage of VBA concepts against advice, you may try your code drafts with
Option VBAsupport 1 and/or
Option Compatible. This way VBA-like code will run in some cases, but in others it will not. Don’t expect to find many experienced helpers here in this case. VBA support is still partly experimental.