bonjour un autre probleme se pose a moi:
je ne sais comment faire ceci:Pièce jointe 25870
bonjour un autre probleme se pose a moi:
je ne sais comment faire ceci:Pièce jointe 25870
faudrait se mettre a l'enregistreur de macro......
tiens voila ce que ca donne grace a cet outil merveilleux que trop peu de monde utilise:
ya des lignes a simplifier mais lessentiel est la...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 Private Sub CommandButton1_Click() i = 2 Do While Cells(i, 2).Borders(xlEdgeBottom).LineStyle <> xlNone i = i + 1 Loop Rows(i & ":" & i).Select Selection.Insert Shift:=xlDown Range("B" & i & ":E" & i).Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With End Sub
ca prend 5minute a faire meme pas![]()
ok j essayerai sa plus tard et je donnerai ma conclusion sur ton code.
Personnellement je n utilise pas l enregistreur car il fait des choses que je ne desire pas.
Personnellement je n utilise pas l enregistreur car il fait des choses que je ne desire pas.des attouchements?
plus sérieusement:
le problème de l'enregistreur c'est qu'il fait tout meme ce qui est pas utile mais faut simplifier derriere.
Un autre problème de l'enregistreur c'est qu'il ne gère pas l'incertitude ou des conditions objectives (suffit de faire des boucles ou des occurences)
en gros c'est un robot pas un cerveau
Le plus grand interet de l'enregistreur c'est de donner une base de code que l'on peut adapter. C'est en parti ca qui te permettra de progresser en Vba
j ai un disfonctionnement en jaune.
une idee many
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 i = 277 Do While Sheets("Main").Cells(i, 5).Borders(xlEdgeBottom).LineStyle <> xlNone i = i + 1 Loop Rows(i & ":" & i).Select Selection.Insert Shift:=xlDown Range("Q" & i & ":J" & i).Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With
Tu peux nettoyer un peu le code, certaines affirmations ne servent à rien comme lui dire de ne pas mettre de diagonale ou de garder la couleur par défaut.
Pour l'erreur sur Rows : Rows(i).Insert suffit
Au fait...as tu encore quelque chose sous ton tableau, un autre tableau, du texte, etc...?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 Rows(i).Insert Range("Q" & i & ":J" & i).Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlMedium End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlMedium End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlMedium End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin End With
Bonjour,
Si on peut se permettre de garder en permanence une ligne vide en fin de tableau, on peut éviter de se coltiner toutes les mises en forme des cellules de la ligne ajoutée et ça donnerait
@+
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Private Sub CommandButton1_Click() Range("B65535").End(xlUp)(2).EntireRow.Insert End Sub
Partager