title: Sheet protection unlocking VBA
body: <p>I am trying to save the sheet with password but I am not able to unlock it with same password, can someone please help me out with getting this resolved.</p>
  
  <pre><code>Sub ClearData()   
  ActiveSheet.Unprotect Password = "Kiran123"
  Sheets("Filter").Select
  Range("A11").Select
  Range(Selection, Selection.End(xlToRight)).Select
  Range(Selection, Selection.End(xlDown)).Select
  Selection.Clear
  Sheets("Filter").Select
  Range("C3").Select
  Selection.Clear
  
  ActiveSheet.Protect Password = "Kiran123"
  End Sub
  </code></pre>
  
  <hr>
  
  <p>Thanks for checking this, However when I have tried with above code(my code) it doesn't work. However when you try it with only below sub it works, why such ambiguity in both the codes. any specific reason why this is occurring ? would be great if I can get an code to lock the sheet with password. </p>
  
  <pre><code>Sub test()
  ActiveSheet.Protect Password:="Kiran123"
  ActiveSheet.Unprotect Password:="Kiran123"
  End Sub
  </code></pre>