title: Format set range to specific currency format all worksheets
body: <p>not sure why this isnt working, but the idea is to open all worksheets, unprotect, format cells to currency, protect again whilst enabling filters. this works for protect and unprotect but trying to format I get an error message:</p>
  
  <blockquote>
    <p>Unable to set the numberformat property of the range class</p>
  </blockquote>
  
  <pre><code>Sub UnProtect()
  
      Dim cell_to_format As Range
  
        ' Loop through all sheets in the workbook
  
        For i = 1 To Sheets.Count
  
           Sheets(i).UnProtect "T1T3NPM"
  
           With ActiveSheet
  
         Range("L8:L99999").Cells.NumberFormat = "£#,##0.00"
  
          Range("O8:O99999").NumberFormat = "£#,##0.00"
  
          Range("R8:R99999").NumberFormat = "£#,##0.00"
  
          Range("U8:U99999").NumberFormat = "£#,##0.00"
  
          Range("X8:X99999").NumberFormat = "£#,##0.00"
  
          Range("AA8:AA99999").NumberFormat = "£#,##0.00"
  
          Range("AD8:AD99999").NumberFormat = "£#,##0.00"
  
      .Protect Password:="T1T3NPM", AllowFiltering:=True
      .EnableSelection = xlUnlockedCells
  End With
  
        Next i
  
  End Sub
  </code></pre>
  
  <p>thanks in  advance</p>