I need a macro or vba codeAnd obviously Asker didn't ask like "How can it be done?"
With any question that I read I would rather start with analysing the situation and suggest solutions rather than starting at the point of an assumed requirement for a specific solution.
In the attached click the button on 2017 Salaries Sheet to run the code and see if this is what you were trying to achieve.
Open in new window