Rafraîchir Userform

Bonsoir chers tous

Toutes mes excuses si je m'explique mal mais voici mon problème.

Depuis mon userform je dois réinitialiser mon fichier en utilisant le code ci dessous qui fait appel à Cinq Macros M1,M2...M5

et a la fin une macro Protect qui protège toutes les feuilles du classeur.

Mais il se trouve qu'au moment de l'exécution de la macro Protect , mon userform devient tout blanc jusque à la fin du processus.

Comment y remédier ?

Merci

Private Sub reinit_Fichier_Click()

If MsgBox(" Voulez-vous Reinitialiser ce Fichier ? ", vbYesNo + 32) = vbYes Then

Me.Label6.BackColor = RGB(255, 255, 255)

Me.Label6.Caption = " Veuillez Patienter SVP : Reinitialisation des Données en cours.......... "

Call M1

Call M2

Call M5

Call Protect

Me.Label6.BackColor = &HFFFFC0

Me.Label6.Caption = ""

End If

End sub

Voici ma macro Protect

Sub Protect()

Application.ScreenUpdating = False

Dim sh As Worksheet

For Each sh In ThisWorkbook.Worksheets

With sh

.Visible = xlSheetVisible

.Unprotect Password:="mdp"

.EnableAutoFilter = True

.EnableOutlining = True

.Cells.Locked = False

On Error Resume Next

.Cells.SpecialCells(xlCellTypeFormulas, 23).Locked = True

.Cells.SpecialCells(xlCellTypeConstants, 2).Locked = False

On Error GoTo 0

.Protect Password:="mdp", _

AllowFormattingCells:=True, _

AllowFormattingColumns:=True, _

AllowFormattingRows:=True, _

AllowInsertingColumns:=False, _

AllowInsertingRows:=False, _

AllowInsertingHyperlinks:=True, _

AllowDeletingColumns:=False, _

AllowDeletingRows:=False, _

AllowSorting:=True, _

AllowFiltering:=True, _

AllowUsingPivotTables:=True, _

UserInterfaceOnly:=True

.EnableSelection = xlUnlockedCells

End With

Next sh

End sub

Juste avant le End Sub de la subroutine Protect, ajoute la ligne suivante:

Application.ScreenUpdating = True

Et voilà!

Cordialement,

--

LR

Merci mais le soucis demeure.

Rechercher des sujets similaires à "rafraichir userform"