I'd like it to be highlighted in both.
The question where the answer is highlighted has tag vba, the other doesn't.
By default, Stack Exchange uses the tags on a question to determine the language you are using.
It is possible to explicitly override the default highlighting language in use on the post with your language of choice for a specific code block, by specifying a language hint above the code block. Note that this is only supported when using the code fence (```) method of code formatting; since the implementation of CommonMark, doing so on code blocks using the four-space indent method is no longer supported*:
code goes here
To add the highlights to your answer without adding the tag to the question you can add the following to your answer before the code block:
I've done this for you. Note you have to also add
At the end of the code block and remove the code indenting.
Source: What is syntax highlighting and how does it work? - Meta Stack Exchange.