It threw a code 21 , throttle position sensor bad code. i replaced it and the code went away but i still have no spark.

six monthes ago i replaced the cranshaft sensor because it just died and would not start. finally figured out it was the security key. fixed that ran no problem. 2 weeks ago it started to run bad again. i checked for codes and got a bad camshaft sensor and throttle postion sensor are bad codes because it would not stat again. i replaced them bothe. the codes went away but still noe spark. whats next

My car has 187000 miles.
My car has an automatic transmission.

– It threw a code 21 , throttle position sensor bad code. i replaced it and the code went away but i still have no spark.