If your radio is locked and will not accept a code, then the normal method to reset it is to LEAVE IT SWITCHED ON....UNDISTURBED for as long as it takes to reset.
This can be several hours.
Make sure you have the correct code.
If you are unsure about the code POST ANOTHER QUESTION
quoting the radio MAKE+MODEL plus ALL the LETTERS+NUMBERS on ANY LABELS ,BARCODES or STAMPED IN THE METAL CASING
Also quote the MAKE of CAR
note: Unfortunately not all radios can be decoded using the Serial Number ..especially VW radios
If not then try your Main Dealer ...........or take it into a Decode Service who will plug in a laptop to read/recode the memory chip (EEPROM). This takes a few minutes and shouldn`t be too expensive