Hello Abdul
Welcome to ExcelFox

I am not familiar with the macro you posted : I am not sure what it is supposed to do.

Can you please:
_ Tell us where you got it from ( give us the URL link )
_ Explain in as much detail as you can what it is you want to do. Possibly it would be helpful to also upload a sample file to help explain


If no one else can help, then I will take another look , possibly tomorrow

Alan