Replace a name that has been written backwards

  • If your code first deletes A21:A30, then there will no names to replace. Please clarify.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Yeah, the code clean that part because is no useful to me, it does not matter if in that part there are inspectors names or not bacause is not useful to me that part, for that reason I removed it.

  • I don't quite understand. You said that you want to replace the names in the Data Base with the code in column C. I need to know the range that contains the names you want to replace in sheets Anagrafica audit and report stampabile. For example:


    AGOSTINO Antonio A1
    BALSAMO Alessandro A2
    BOSCO Gian Carlo A3

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • As I said you before the inspectors names in sheet Anagrafica audit can be in cells a12:a17, a12:25 etc, there is not a specific range because in every file can vary, for that reason when I made the code I never specify the range, for example in this lines of code I made that anywhere where is the name "Pier Giorgio Spazzini" replace it for the number 6.


    Code
    Worksheets("Anagrafica audit").Cells.replace What:="Pier Giorgio SPAZZINI", Replacement:="6"
    Worksheets("report stampabile").Cells.replace What:="Pier Giorgio SPAZZINI", Replacement:="6"
  • Try the attached file. To ensure that the user enters names in the correct order, I have added a userform. When you click in column A under "Nome e Cognome" in the "Anagrafica audit" sheet, the form will pop up for the user to fill in the name and surname. When the "OK" button is clicked the name will be automatically entered into the cell. The revised macro is in Module1. Try it out and see how it works for you.

    Files

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • In the DataBase sheet, add the laboratories in column D and their corresponding codes in column E and post a copy of the updated file.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • it's happening something unusual, in B4 where have to be the Code of the lab, the macro just give me the code when the cell B4 is in text format in other cases B4 does not put the code.

    Do you know what can I do in this case?

  • Try formatting B4 as "Text".

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!