Based on your description, do you mean that you would like to use VBA to realize your requirement?
I will add a tag "office-vba-dev" for you to get related help since tag "office-excel-itpro" focuses on general issues about Excel clients.
Could you please give a sample so that we could understand your issue better or do a test for you?
Any misunderstandings or updates, please feel free to post back.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.