You choose the target of Codex Shredder's last ability before paying its costs, so you can't return Codex Shredder to your hand this way.

Artwork
Loading artwork…
Codex Shredder
Commander Legends · #304 · EN
Nonfoil—Foil—
Card rules
Uncommon · Illustrated by Jason Felix
Format legality
Commander Legal
Duel Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pioneer Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions