Investors & landlords

Sorry but that is a sale and you pay cap gains no matter what the profits are used to purchase.