Copied this from the fix bates range tool in the summation dir and deleted the stuff that I dont need. I use these functions quite often and for many tools.