thunder23
XLDnaute Occasionnel
Salut le Forum,
J'ai un soucis depuis un certains temps avec ce code qui est présent sur une feuille EXCEL. Celui-ci me créer un deuxième "this Workbook" voir plusieurs si j'ouvre en simultané un autre fichier Excel avec macros (peu-être identique).
Le seul moyen que j'ai trouvé est d'enregistrer le fichier sans les macros et de recopier, un à un, celles-ci.
Je n'arrive pas à savoir laquelle me fait ce bug, est-ce que quelqu'un serait d'où ça pourrait venir?
S'il y a besoin d'un fichier, je peux le fournir, Merci d'avance pour vos retours 😉
J'ai un soucis depuis un certains temps avec ce code qui est présent sur une feuille EXCEL. Celui-ci me créer un deuxième "this Workbook" voir plusieurs si j'ouvre en simultané un autre fichier Excel avec macros (peu-être identique).
Le seul moyen que j'ai trouvé est d'enregistrer le fichier sans les macros et de recopier, un à un, celles-ci.
Je n'arrive pas à savoir laquelle me fait ce bug, est-ce que quelqu'un serait d'où ça pourrait venir?
S'il y a besoin d'un fichier, je peux le fournir, Merci d'avance pour vos retours 😉
VB:
Private Sub Worksheet_Change(ByVal Target As Range) 'Appel de macro pour effacer tous contenu et commentaire sur les feuilles
Dim DateExpiree As Date
DateExpiree = Sheets("BDD").[Date_Licence].Value
If Target.Address = "$L$5" Then
If Sheets("BDD").[Date_Licence].Value = "" Then
MsgBox "Le programme est en version d'essaie, veuillez ajouter une licence pour une utilisation complète !", vbOKOnly + vbInformation, "Version d'essaie"
SendKeys "{ESC}"
ElseIf Date > DateExpiree Then
MsgBox "Votre licence a expiré, utilisation limitée !", vbOKOnly + vbCritical, "Licence expirée"
SendKeys "{ESC}"
Else
'la ligne suivante exécute la macro
Call clear_gta
UserForm_poste.Show
End If
End If
End Sub
Private Sub CommandButton_renouveler_Click()
Call UserForm_licence.Show
End Sub
Private Sub CombBox_mois_Change()
With Sheets("GTA").ComboBox_mois
[Cbx_mois] = ComboBox_mois.Value 'Sheets("BDD").[aj6]
.Clear
For i = 1 To 12
.AddItem Format(DateSerial(1, i, 1), "mmmm")
Next
.ListIndex = 0
End With
End Sub
Private Sub ComboBox_mois_Change()
Dim protect As String
protect = [niveau_utilisateur]
Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("GTA").Unprotect ("1234")
Dim dernier As Long
[Cbx_mois] = ComboBox_mois.Value
dernier = Day(DateAdd("m", 1, [B12]) - 1)
If protect = 3 Then
ActiveWorkbook.Worksheets("GTA").Unprotect ("1234")
Else
ActiveWorkbook.Worksheets("GTA").protect ("1234")
End If
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton_droite_Click()
[ComboBox_mois].ListIndex = _
WorksheetFunction.Min([ComboBox_mois].ListIndex + 1, [ComboBox_mois].ListCount - 1)
End Sub
Private Sub CommandButton_gauche_Click()
[ComboBox_mois].ListIndex = _
WorksheetFunction.Max([ComboBox_mois].ListIndex - 1, 0)
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'Permet d'afficher le commentaire en fonction de la date sélectionnée
ActiveWorkbook.Worksheets("GTA").Unprotect ("1234")
Dim cell As Object
For Each cell In Range("B8:AF8")
Range("K17").Value = ActiveCell.Value
Next cell
Cancel = True
SendKeys "{ENTER}", True
ActiveWorkbook.Worksheets("GTA").protect ("1234")
'End If
Application.OnTime Now + TimeValue("00:00:10"), "efface_cellule"
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim DateExpiree As Date
DateExpiree = Sheets("BDD").[Date_Licence].Value
If [Date_Licence].Value = "" Then
MsgBox "Le programme est en version d'essaie, veuillez ajouter une licence pour une utilisation complète !", vbOKOnly + vbInformation, "Version d'essaie"
SendKeys "{TAB}", True
SendKeys "{ESC}", True
ElseIf Date > DateExpiree Then
MsgBox "Votre licence a expiré, utilisation limitée !", vbOKOnly + vbCritical, "Licence expirée"
SendKeys "{TAB}", True
SendKeys "{ESC}", True
Else
If Not Application.Intersect(Target, Range("B8:AF8")) Is Nothing Then
UserForm_jour.ComboBox_date.List = Application.Transpose(Sheets("GTA").Range("B8:AF8").Value)
UserForm_jour.ComboBox_date.ListIndex = Target.Column - 2
Cancel = True
UserForm_jour.Show
Load UserForm_jour
End If
End If
End Sub