XL 2019 bouton effacer vba

frederio

XLDnaute Impliqué
Bonsoir a tous

Tu vous connais comment faire bouton supprimer vba Sur la 1ère feuille "BUNDESLIGA" en G avec H et tous les autres feuilles "SAISON" en J avec M

Si tu veux être d’accord avec moi ??? vous m’aidez a expliqué comme Excel Merci
 

Pièces jointes

  • effacer.xlsm
    467.2 KB · Affichages: 9

frederio

XLDnaute Impliqué
C’est fichier 7 pays c’est bon sur Excel

C'est problème 1 en France

2020-08-27_19-03-43.jpg
2020-08-27_19-04-26.jpg
 

soan

XLDnaute Barbatruc
Inactif
Bonsoir frederio, le fil,

Je te retourne ton fichier, où j'ai fait plusieurs modifications.

Regarde d'abord le code VBA de ThisWorkbook :
VB:
Option Explicit

Private Sub Workbook_Open()
  Dim i As Byte
  With Worksheets("LIGUE 1")
    .ComboBox1.Clear
    For i = 1 To 38
      .ComboBox1.AddItem i
    Next i
  End With
End Sub
Puis celui de Feuil1 :
Code:
Option Explicit

Dim lig& 'mémorise la variable

Private Sub ComboBox1_Change()
  lig = ActiveWindow.ScrollRow
  If ComboBox1.ListIndex = -1 Then ComboBox1 = "": Application.Goto [A1], True: Exit Sub
  Application.Goto Range("A" & ComboBox1 * 12 - 9), True
End Sub

Sub Retour()
  If lig Then Application.Goto Range("A" & lig), True
End Sub

Private Sub CommandButton1_Click()
  Worksheets("LIGUE 1").Range("G4, G5:G457, H4:H457").Value = ""
  Worksheets("SAISON").Range("J3:J382, M3:M382").Value = ""
  MsgBox "form has been reset."
End Sub
Et celui de Module2 :
Code:
Option Explicit

Sub effacer()
  If ActiveSheet.Name <> "LIGUE 1" Then Exit Sub
  Application.ScreenUpdating = 0: Application.Calculation = -4135
  Dim dlg&, lig&: dlg = Cells(Rows.Count, 4).End(3).Row
  For lig = dlg To 4 Step -12
    Cells(lig - 9, 6).Resize(9, 4).ClearContents
  Next lig
  Application.Calculation = -4105
End Sub
soan
 

Pièces jointes

  • France.xlsm
    537.2 KB · Affichages: 6
Dernière édition:

Statistiques des forums

Discussions
312 196
Messages
2 086 101
Membres
103 116
dernier inscrit
kutobi87