When sampling I usually find the loop or section I want, adjust the gain to make sure it's loud enough with out clipping. Then I set my record to play for about 8 bars before the part I want. I count along out loud and tap my left hand on my desk with the beat. I hit start on the 1st beat and count 1 + 2 + 3 + 4 + 1, on the 1 I hit stop. This will give you a perfect 4 bar loop. I prefer to get it right when sampling rather than recording too much and wasting time in Trim mode.
Now go into program mode and set it to a pad and make it monophonic. Hit the pad and punch in the tempo with tap tempo. Tap Tempo works better for me if you set it to 4 taps and only press the button rather than hitting it. This may take some getting used to. Now put your loop into a sequence, either by setting it to 1/8 TC or by inserting it at the proper times in Step edit.
If you do this correctly you should get a perfectly looped sample. Now if you want to change the tempo by pitching, rather than sitting there trying to make it fit perfectly, goto this webpage:
http://www.jmaguire.com/audio_tools.php
This is a Time-stretch, Pitch-shift, Transposing, Tempo, and Delay calculator. For example, you can enter the current BPM and your destination BPM, and it will tell you how much to pitch it to make it fit. Bless the guy who programmed this page, I use it all the time. I hope this helps you guys out.

Now build it up.