Excel - Proteccion de hoja

 
Vista:

Proteccion de hoja

Publicado por José (39 intervenciones) el 19/11/2012 02:12:47
Hola,
tengo un procedimiento que se ejecuta bien, pero que cuando protejo la hoja de calculo con una clave me dice que no puede asignar los valores y da error.
el procedimiento es el siguiente:

Sub POSELIGNESSAISSIE(F, S)
On Error GoTo TraitementErreur
'Call POSELIGNESSAISSIE(F, "$A$11:$A$900")
'F = un nombre de hoja del libro excel
'S = un rango("$A$11:$A$900")
Sheets(F).Range(S).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("C11").Select
'****************************************Traitement d'erreurs
RepriseProgramme:
Exit Sub
TraitementErreur:
MsgBox Err.Number & " - " & Err.Description & " - " & "Erreur dans redessiner les lignes des cellules"
End Sub

¿Como podria hacer para que me funcione con la hoja protegida lo mismo que conla hoja desprotegida?
Si alguien puede ayudarme gracias de antemano.
Un saludo
José
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder