XL 2019 Date

le___destin

XLDnaute Occasionnel
Je veux créer une colone d'un tableau lorsque je rempli la premiere case emplie automatiquement les autre cellule jusqu'à la date du fin du moi
 

danielco

XLDnaute Accro
Je ne comprends pas pourquoi tu me parles de ces cellules qui ne sont pas dans le tableau ?

Annotation 2019-09-14 125349.png


Fais un effort pour bien m'expliquer en détail. Je passe trop de temps à essayer de comprendre.

Daniel
 

danielco

XLDnaute Accro
Compris.

Essaie :

VB:
Private Sub Worksheet_Calculate()
Dim C As Range, ResC As String, Cellule As Range
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  For Each C In Range("F12", Cells(Rows.Count, 6).End(xlUp))
    If C.Offset(, -2) <> "" And C.Offset(, -2) <> ResC Then
      ResC = C
      If Application.CountIf(C.Resize(3), "- -") = 3 Then
        Application.DisplayAlerts = False
        C.Offset(, 1).Resize(3).Copy Cells(C.Row, 15)
        C.Offset(, 1).Resize(3).Validation.Delete
        C.Offset(, 1).Resize(3).MergeCells = True
        Application.DisplayAlerts = True
        GoTo Fin
      End If
      If C.Offset(, 1).Resize(3).MergeCells = True Then
        C.Offset(, 1).Resize(3).MergeCells = False
        Cells(C.Row, 15).Resize(3).Copy C.Offset(, 1)
      End If
      For Each Cellule In C.Resize(3)
        If Cellule.Value = "- -" Then
          Cellule.EntireRow.Hidden = True
        Else
          Cellule.EntireRow.Hidden = False
        End If
      Next Cellule
    End If
Fin:
  Next C
  Application.EnableEvents = True
  Application.ScreenUpdating = True
End Sub

Tu dois supprimer tous les codes de ta feuille et notamment celui qui se trouve dans le module ThisWorkbook. De plus, je ne comprends pas ce qu'il faut faire sur la feuille Feuil1.

Daniel
 

Pièces jointes

  • destin 2019 09 14.xlsm
    40.9 KB · Affichages: 5

danielco

XLDnaute Accro
alors que je veux quel soit F12:M15

Je suppose que tu veux dire alors que je veux quel soit F12:M15 G12:M14 ?

VB:
Private Sub Worksheet_Calculate()
Dim C As Range, ResC As String, Cellule As Range
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  For Each C In Range("F12", Cells(Rows.Count, 6).End(xlUp))
    If C.Offset(, -2) <> "" And C.Offset(, -2) <> ResC Then
      ResC = C
      If Application.CountIf(C.Resize(3), "- -") = 3 Then
        Application.DisplayAlerts = False
        C.Offset(, 1).Resize(3, 7).Copy Cells(C.Row, 22)
        C.Offset(, 1).Resize(3, 7).Validation.Delete
        C.Offset(, 1).Resize(3, 7).MergeCells = True
        Application.DisplayAlerts = True
        GoTo Fin
      End If
      If C.Offset(, 1).Resize(3).MergeCells = True Then
        C.Offset(, 1).Resize(3, 7).MergeCells = False
        Cells(C.Row, 22).Resize(3, 7).Copy C.Offset(, 1)
      End If
      For Each Cellule In C.Resize(3)
        If Cellule.Value = "- -" Then
          Cellule.EntireRow.Hidden = True
        Else
          Cellule.EntireRow.Hidden = False
        End If
      Next Cellule
    End If
Fin:
  Next C
  Application.EnableEvents = True
  Application.ScreenUpdating = True
End Sub

Daniel
 

danielco

XLDnaute Accro
Pfff... Ça devient chaud ! Essaie :

VB:
Private Sub Worksheet_Calculate()
  Dim C As Range, ResC As String, Cellule As Range
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  For Each C In Range("F12", Cells(Rows.Count, 6).End(xlUp))
    If C.Offset(, -2) <> "" And C.Offset(, -2) <> ResC Then
      Debug.Print C.Address(0, 0)
      ResC = C
      If Application.CountIf(C.Resize(3), "- -") = 3 Then
        If C.Offset(, 1).Resize(3).MergeCells = False Then
          Application.DisplayAlerts = False
          C.Offset(, 1).Resize(3, 7).Copy Cells(C.Row, 22)
          C.Offset(, 1).Resize(3, 7).Validation.Delete
          C.Offset(, 1).Resize(3, 7).MergeCells = True
          Application.DisplayAlerts = True
        End If
        GoTo Fin
      End If
      If C.Offset(, 1).Resize(3).MergeCells = True Then
        C.Offset(, 1).Resize(3, 7).MergeCells = False
        Cells(C.Row, 22).Resize(3, 7).Copy C.Offset(, 1)
      End If
      For Each Cellule In C.Resize(3)
        If Cellule.Value = "- -" Then
          Cellule.EntireRow.Hidden = True
        Else
          Cellule.EntireRow.Hidden = False
        End If
      Next Cellule
    End If
Fin:
  Next C
  Application.EnableEvents = True
  Application.ScreenUpdating = True
End Sub
 

Discussions similaires

Réponses
15
Affichages
628
Réponses
7
Affichages
316

Statistiques des forums

Discussions
312 177
Messages
2 085 977
Membres
103 078
dernier inscrit
diomy