Even if the user has pressed 23 different keys, keep writing beyond the end of the array...
You REALLY need to make sure that there is room in the array BEFORE you write to it.
with * a number that you enter is deleted.
case '*': //La tecla B sirve para borrar el caracter anterior escrito
lcd.setCursor(0, 1);
lcd.clear();
break;
Just erasing what was on the LCD is nowhere near enough. Remember the array you are storing data in? That needs to be cleared, too. Remember the index into that array? That needs to be reset to 0, too.
case '#': //La tecla C borra TODO lo escrito en la pantalla y posiciona el cursor en (0,0)
EEPROM.write(eepromcaja1,indice);// Escribimos en la memoria eeprom
menu=0;
lcd.clear();
break;
Storing the array index in EEPROM seems like a dumb thing to do. Storing the data in the array seems more useful. YMMV.
I have executed your program in a real setup. My observations are: 1. While entering 10-digit number (any combination of 0 to 9), the program also responses to C, D, and etc. Is this correct?
2. After 10-digit entry (say, 1, 2, 3, 4, ..., 9, 0), I pressed '#' to save the number in EEPROM. It looks like that some kind of action has been taken; but, there is no message/indication on the issue that the number has been saved in EEPROM. Anyway, I have assumed that the number is saved.
3. I pressed 'B' with a hope to see the number back on LCD; the number has not appeared.
I think that we need to draw the Flow Chart first that will clearly describe your program requirements. Flow Chart is a great Tool in the development of Complex Program as it provides the 'Basic Start up' onto which we can slowly add other features.
Thanks a lot for the good works that you have done so far.