How to pick which shares unit to sell in given ticker

I want to sell my recent MSFT buys that are in the red to book a loss, but I want to keep my older profitable shares untouched.