2007 Chevrolet Malibu CEL is still on

Check engine light is on. I replaced the gas cap but the light didn’t go off

What code(s) are you getting?

You really need to know the specific code. There are hundreds of them and a new gas cap will not be the answer to all of them.

Take the car to a local auto parts store like Advance, Autozone etc. They will read the codes for free (unless you are in California) Post the codes here they will look like P1234