title: how to have unlocked cells on a protected VBA created worksheet
body: <p>An input file of data is processed using VBA to create an Excel(2003) protected spreadsheet(Invoice).
  The spreadsheet is then to be distributed to other offices where some designated cells are to be amended. 
  How can I create the worksheet to allow these cells to be amended when the whole sheet is protected?
  I have tried using the code below, and other similar variations, but it does not seem to work.
  Can you help?</p>
  
  <pre><code>Private Sub CellLock1()
  
    Cells.Select
    ' unlock all the cells
    Selection.Locked = False
  
    ' lock only these cells
    Range("J49:K49").Select
    Selection.Locked = True
  
   ActiveSheet.Protect DrawingObjects:=True, _
                       Contents:=True, _
                       Scenarios:=True, _
                       UserInterfaceOnly:=True, _
                       AllowFormattingCells:=True, _
                       AllowFormattingColumns:=True, _
                       AllowFormattingRows:=True, _
                       AllowInsertingColumns:=True, _
                       AllowInsertingRows:=True, _
                       AllowInsertingHyperlinks:=True, _
                       AllowDeletingColumns:=True, _
                       AllowDeletingRows:=True, _
                       AllowSorting:=True, _
                       AllowFiltering:=True, _
                       AllowUsingPivotTables:=True
  
  End Sub
  </code></pre>