thanks Teylyn, But when using that with "CODE" in the place of "MyRange" I get a runtime error 13: type mismatch.