protezione celle



  • protezione celle
    di trittico69 (utente non iscritto) data: 28/08/2014 10:01:06

    salve mi servirebbe un aiuto a modificare questo codice che nasconde alcune celle vuote e ne protegge alcune in modo che non protegga le celle da n 13 a n 57 di tutti i fogli
    grazie
     
    Public Sub NascondiRigheVuote() 'nasconde righe vuote e protegge fogli
      Dim sh, rr As Long
          Application.ScreenUpdating = False
          For Each sh In Sheets
              With sh
                  .Unprotect
                  If .Name <> "RIEP" And .Name <> "codici servizi" Then
                      .Rows("1:5").Hidden = True
                      With .Range("J12,i12,M9,M10,O9,O12")
                          .Locked = False
                          .FormulaHidden = False
                      End With
                      For rr = 57 To 14 Step -1
                          If Val(.Range("A" & rr)) = 0 Then .Rows(rr).Hidden = True
                      Next rr
                      .Range("K:L,P:Bf").EntireColumn.Hidden = True
                  ElseIf .Name = "RIEP" Then
                      With .Range("C2:C5,J3:J14,A32:A33,A43:A44,C7")
                          .Locked = False
                          .FormulaHidden = False
                      End With
                  End If
                  .Protect DrawingObjects:=False, Contents:=True, Scenarios:=True
              End With
          Next sh
          Application.ScreenUpdating = True
      End Sub