Why couldn’t Republicans who voted to repeal Obamacare so many times under Obama do it under a Republican president?

@tim has given a good answer in terms of the specific vote. However it’s also worth looking at the reason why the Republicans couldn’t get behind a replacement.

The problem that the Republicans face is that the key elements of Obamacare were actually Republican ideas. This paper from the Heritage Foundation outlines the main points which were later introduced into Obamacare. When Mitt Romney was Governor of Massachusetts he introduced a statewide health law based on these same ideas. (Edit: added link to list of similarities and differences)

When President Obama proposed the Affordable Care Act the Republican party was faced with a difficult choice. They could have supported the ACA while pointing out that Obama had merely pinched their best ideas, but this would have meant handing Obama a major political victory and an important historical legacy. Since they hated Obama they couldn’t stomach that, so instead they decided to airbrush out their own history and position themselves in opposition. They managed to make hatred of Obamacare a major mobilising point for their base, but now they have the opportunity to replace Obamacare they are in a bind: they can’t create the scheme they had planned because it would be too obviously Obamacare with a red paint job, but they don’t have any new ideas to replace it.

Trump isn’t helping. He promised to replace the “broken” and “unconstitutional” Obamacare, but never got around to saying what he would replace it with. Then he discovered (to his immense surprise) that it’s complicated.