title: macro over protected and shared worksheet excel
body: <p>I have a shared and protected worsheet in excel 2012. (protected but without password)
  I wrote this macro: </p>
  
  <pre><code>Private Sub CommandButton1_Click()
      ActiveSheet.Unprotect
      Range("B4:K38").Select
      Selection.Sort Key1:=Range("D4"), Order1:=xlAscending, Header:=xlGuess, _
          OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
          DataOption1:=xlSortNormal
     'cells I don't want to be protect (to be user-editable)
      Range("B4:K38").Locked = False
     'protecting the sheet, and all the other cells will be protected
      Protect UserInterfaceOnly:=True
  End Sub
  </code></pre>
  
  <p>But everytime I use this macro I have a message that shows me that there's an error with the method protect.</p>
  
  <p>What am I doing wrong?</p>