'Trouble in merging and text centering selected cells with macro

Am new in programming, mainly trying to understand coding through recording macros.

I have difficulty trying to merge and text center (vertically and horizontally) a selection of cells - could be on different ranges every time. Although I tried some macro recording as well as trying to find relevant resources, my macro programming experience doesn't helps me much.

Could you please assist me a bit with a code?

Truly appreciated. Thank you very much!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source