In this code, actually, Hans is the only sheet that should work correctly.
Never do this if you don't know exactly what error you are expecting. If an error occurs you will never know about it. For example, if the sheet is Jan Details but you misspelled it in your code as Hans Details, you will never know.
The variable names are very cryptic and so make the code very confusing to read. It is necessary to keep checking back and forth. This has caused you to misspell variable names
The second line is causing an error because xI3DRg is not defined, and you are suppressing the error. If you used Option Explicit you would have found this error. I strongly recommend to everyone that they use Option Explicit and declare variables. Doing so prevents a lot of bugs and runtime errors.
ALSO
This line of code is not causing your problem but it doesn't do what you think it does:
In a Dim statement, each variable must get its own data type. Onl xID3Rg is a Range variable. All the other ones will default to Variant. Do this:
Indentation and spacing in the code make it much easier to read.
I have provided a more readable, correct, and tested version of your code.
What other formatting is there? Is there formatting in Main that you do not want to copy? If not, then this is much simpler and much faster than your approach.
Bookmarks