When an offense is committed partly in one county and partly in one or more other counties within this state, it may be alleged that the offense was committed and the accused may be tried in any one county in which any substantial element of the offense occurred.