Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

appliquer EnableSelection = xlUnlockedCells à tous les onglets

2 réponses
Avatar
Sunburn
Bonjour,
j'ai une macro pour protéger tous mes onglets. comment préciser, pour tous
les onglets "EnableSelection = xlUnlockedCells", et non pas pour l'onglet
actif ?
yann
-------
' Protection automatique de toutes les feuilles d'un classeur
Sub PROTEGERFEUILLES()
Dim nombre As Integer
nombre = ActiveWorkbook.Sheets.Count
Application.ScreenUpdating = False
For I = 1 To nombre
Worksheets(I).Protect , DrawingObjects:=True ', UserInterfaceOnly:=True
Active.Worksheets.EnableSelection = xlUnlockedCells
Next I
End Sub
---------

2 réponses

Avatar
isabelle
bonjour Sunburn,

Sub PROTEGERFEUILLES()
Dim nombre As Integer
nombre = ActiveWorkbook.Sheets.Count
Application.ScreenUpdating = False
For I = 1 To nombre
With Worksheets(I)
.Protect , DrawingObjects:=True ', UserInterfaceOnly:=True
.EnableSelection = xlUnlockedCells
End With
Next I
End Sub

isabelle

Sunburn a écrit :
Bonjour,
j'ai une macro pour protéger tous mes onglets. comment préciser, pour tous
les onglets "EnableSelection = xlUnlockedCells", et non pas pour l'onglet
actif ?
yann
-------
' Protection automatique de toutes les feuilles d'un classeur
Sub PROTEGERFEUILLES()
Dim nombre As Integer
nombre = ActiveWorkbook.Sheets.Count
Application.ScreenUpdating = False
For I = 1 To nombre
Worksheets(I).Protect , DrawingObjects:=True ', UserInterfaceOnly:=True
Active.Worksheets.EnableSelection = xlUnlockedCells
Next I
End Sub
---------


Avatar
Sunburn
Merci isabelle, ça fonctionne.
Par contre, il n'y a qu'un .
Merci beaucoup.
YANN

"isabelle" a écrit :

bonjour Sunburn,

Sub PROTEGERFEUILLES()
Dim nombre As Integer
nombre = ActiveWorkbook.Sheets.Count
Application.ScreenUpdating = False
For I = 1 To nombre
With Worksheets(I)
..Protect , DrawingObjects:=True ', UserInterfaceOnly:=True
..EnableSelection = xlUnlockedCells
End With
Next I
End Sub

isabelle

Sunburn a écrit :
> Bonjour,
> j'ai une macro pour protéger tous mes onglets. comment préciser, pour tous
> les onglets "EnableSelection = xlUnlockedCells", et non pas pour l'onglet
> actif ?
> yann
> -------
> ' Protection automatique de toutes les feuilles d'un classeur
> Sub PROTEGERFEUILLES()
> Dim nombre As Integer
> nombre = ActiveWorkbook.Sheets.Count
> Application.ScreenUpdating = False
> For I = 1 To nombre
> Worksheets(I).Protect , DrawingObjects:=True ', UserInterfaceOnly:=True
> Active.Worksheets.EnableSelection = xlUnlockedCells
> Next I
> End Sub
> ---------