I am going to assume that you are referring to scenes 3 and 4 of Act 3 because this is a clear place in the play where we see the contrast between action and inaction. In Act 3 Scene 3 Hamlet knows for sure now that Claudius is guilty of killing King Hamlet and Hamlet is ready to get his revenge. He is walking down the hall of the castle and comes upon Claudius while he is alone. The timing is perfect, except for the fact that Claudius appears to be at prayer. Hamlet has his sword up and is ready to strike, but then he starts thinking about his actions and realizes that
Now he is praying;
And now I'll do it. And so he goes to heaven,
And so am I revenged. That would be scanned.
A villain kill my father; and for that,
I, his sole son, do this same villain send
Hamlet can't live with the idea that his dead father will continue to suffer in purgatory while the killer, Claudius, would go straight to heaven because he is praying for forgiveness and therefore would die with a clear soul. Hamlet decides to wait until Claudius is
drunk asleep; or in his rage;
Or in the incestuous pleasure of his bed;
At gaming, swearing, or about some act
That has no relish of salvation in't.
Hamlet wants to ensure that his revenge sends Claudius to hell and eternal punishment. The irony of the scene is that Claudius is actually unable to TRULY pray for forgiveness because he isn't willing to give up all he has gained from his crimes.
Coming off of this circumstance, Hamlet is still in a state of readiness to kill Claudius, so when he hears a voice from behind the curtain in his mother's room, he stabs through it without a thought. He assumes it is Claudius. He even says to the dead Polonius "I took you for your better." Ultimately, he is able to act because he has proof (from the play within a play) that Claudius is guilty and he will take whatever opportunities arise, but he will only act if the vengeance will satisfy his sensibilities.