Microsoft 365 Copier info feuille 1 en 2

walido78

XLDnaute Nouveau
Bonjour,
Je viens de créer un fichier excel avec plusieurs macros, et j'ai éventuellement la possibilité d'ajouter plusieurs lots sur la feuille 1, avec une cellule contenant deux checkbox Retenue : Oui ou Non). J'ai donc un problème avec ma macro parce qu'elle n'est pas tout a fait fonctionnelle:
1) Je veux que quand une personne Coche oui, les informations sur cette ligne soit copié sur la ligne similaire dans la feuille 2.(Et du coup si elle coche non, que le lot n'apparait pas dans la feuille 2)
2) A chaque fois que quelqu'un appuis sur le bouton ajouter un lot une ligne s'ajoute AVEC un calendrier et deux checkbox (oui et non)
J'ai testé cette macro mais elle n'est pas top:
Macro pour copier sur feuille 2 (elle recopie tout et non pas la première ligne):

Sub Casdoption130_Cliquer()
Dim WsS As Worksheet, WsC As Worksheet
Dim Cel As Range, C As Range
Dim LigneAjout As Long
Set WsS = Worksheets("ENT_BET")
Set WsC = Worksheets("Retenue")
Set LC = WsS.Range("B3:B3" & WsS.Range("B" & Rows.Count).End(xlUp).Row)
Set C = WsC.Columns(1).Find(LC, , xlValues, xlWhole)
LigneAjout = WsC.Range("B" & Rows.Count).End(xlUp).Row + 1
If Not C Is Nothing Then
LC.Resize(, 16).Copy WsC.Range("B" & C.Row)
Else
LC.Resize(, 16).Copy WsC.Range("B" & LigneAjout)
LigneAjout = LigneAjout + 1
End If

Set C = Nothing: Set WsS = Nothing: Set WsC = Nothing
End Sub

Macro : ajouter un lot:
Sub Bouton135_Cliquer()
Range("B4:G4").Select
Selection.EntireRow.Insert
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
End Sub

Merci d'avance pour votre aide
 

Pièces jointes

  • Fichiertest.xlsm
    248.9 KB · Affichages: 2

Discussions similaires

Réponses
1
Affichages
194
Réponses
0
Affichages
175

Statistiques des forums

Discussions
312 464
Messages
2 088 628
Membres
103 894
dernier inscrit
tanyroc