When any person shall be indicted in any county in this state and an order shall be made for a change of venue to any other county in this state, and the defendant has been admitted to bail and a forfeiture has been taken upon the bond and judgment rendered thereon by the court of the county in which the cause stands for trial, the judgment when collected shall be paid by the sheriff into the treasury of the county in which the indictment was found.