The error displayed is
Run-time error '1004':
You cannot use this command on a protected sheet. To use this command, you must first unprotect the sheet (Review tab, Changes group, Unprotect Sheet button). You may be prompted for a password.
However, the fact is that I can run my other codes using above method but when comes to the line, it shows error.