XL 2016 Problème Macro XL2010 vers XL2016

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

R@chid

XLDnaute Barbatruc
Supporter XLD
Bonjour,
svp, j'ai ces deux macros qui fonctionnaient très bien avec la version 2010, maintenant que je suis passé à la version 2016, les macros posent problème et fonctionnent pas et étant nul en la matière je ne sais pas vraiment d'où vient le problème.

Macro 1 :
Sub AfficherOngletsEleves(Optional Factice As String)
Dim w As Worksheet, af As Variant
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect Password:="MotDePasse"
For Each w In Worksheets
If w.Name = w.[C7] Then Problème sur cette ligne
If IsEmpty(af) Then af = Not w.Visible
w.Visible = af
End If
Next
ActiveWorkbook.Protect Password:="MotDePasse"
End Sub


Macro 2:
Sub AfficherOnglets(Optional Factice As String)
Dim w As Worksheet, af As Variant
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect Password:="MotDePasse"
For Each w In Worksheets
If w.[B7] Like "*Nom*" And w.[C7] = "" Then
If IsEmpty(af) Then af = Not w.Visible
w.Visible = af
End If
Next
ActiveWorkbook.Protect Password:="MotDePasse"
End Sub


Je remercie d'avance M. Job75 qui m'a beaucoup aidé et qui m'a fait les macros.

et merci à tout le monde de l'attention que vous voudrez porter à ma question

Re : problème résolu tout seul, les macros ont été corrompues apparemment et je ne sais pas pourquoi.
Merci
 
Dernière édition:
Bonsoir, le fil, le forum, R@chid 😉

Ta macro initiale fonctionne sur Excel 2013
A tout hasard, j'ai modifié ainsi (ça fonctionne aussi sur Excel 2013)
VB:
Sub AfficherOngletsEleves()
Dim w As Worksheet, af As Variant
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect Password:="MotDePasse"
For Each w In Worksheets
If w.Name = w.Range("C7") Then
If IsEmpty(af) Then af = Not w.Visible
w.Visible = af
End If
Next
ActiveWorkbook.Protect Password:="MotDePasse"
End Sub

NB: Sub AfficherOnglets() fonctionne aussi sur Excel 2013.
J'ai laissé le Optional Factice As String
et tester la macro ainsi
VB:
Sub Test()
AfficherOnglets
End Sub
 
Dernière édition:
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
5
Affichages
702
Retour