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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
Public colpil As Integer
Public rawpil As Integer
Public cold As Integer
Public colg As Integer
Public colres As Integer
Public color As Integer
Public color1 As Integer
Public color2 As Integer
Public colbut As Integer
'Sub Macros_Denis()
'Couleurs de base
'xlNone rien
'6 Jaune
'3 Rouge
'41 Bleu
'36 Jaune pale
'35 Bleu pale
'7 Violet
Sub Macros_couleurs_alternatives()
' Macro enregistrée le 27/11/2007 par Denis
' Pour colorier alternativement les lignes de couleurs
MsgBox ("Macro COLORIAGE ALTERNATIF DES LIGNES Avant de lancer la Macro, assurez vous d'avoir trié les données sur la colonne souhaitée, et qu'il n'y a pas de lignes vides")
'Title = "Macro COLORIAGE ALTERNATIF DES LIGNES"
'MsgBox(, , , , msg, Title)
Msg = "Colonne pilote pour le changement de couleur"
Title = "Position du pilote (pour la boucle)"
colpil = Application.InputBox(Msg, Title)
Msg = "Colonne de pour touver la fin de liste (colonne complète sans blanc)"
Title = "Position du pilote (pour la boucle)"
colbut = Application.InputBox(Msg, Title)
Msg = "Ligne de départ"
Title = "Ligne de départ"
rowpil = Application.InputBox(Msg, Title)
Msg = "Colonne de gauche"
Title = "Sélection des colonnes de gauche"
colg = Application.InputBox(Msg, Title)
Msg = "Colonne de droite"
Title = "Sélection des colonnes de droite"
cold = Application.InputBox(Msg, Title)
Msg = "Couleur 1"
Title = "Sélect des couleurs R=3, V=4, BF=5"
color1 = Application.InputBox(Msg, Title, 34)
Msg = "Couleur 2"
Title = "Sélect des couleurs R=3, V=4, BF=5"
color2 = Application.InputBox(Msg, Title, 36)
color = color1
'color1 = 36
'color2 = 34
Range(Cells(rowpil, colbut), Cells(rowpil, colbut)).Select
macellbut = ActiveCell.Value
Range(Cells(rowpil, colpil), Cells(rowpil, colpil)).Select
macell = ActiveCell.Value
nlig = ActiveCell.Row
Do While Not IsEmpty(macellbut)
Range(Cells(nlig, colpil), Cells(nlig, colpil)).Select
macell = ActiveCell.Value
macell1 = Selection.Offset(1, 0).Value
macellbut = Selection.Offset(1, colbut).Value
macellbut = Range(Cells(nlig, colbut), Cells(nlig, colbut)).Value
Range(Cells(nlig, colg), Cells(nlig, cold)).Select
Selection.Interior.ColorIndex = color
'changement de couleur
If macell <> macell1 Then
If color = color2 Then
color = color1
ElseIf color = color1 Then
color = color2
End If
End If
nlig = nlig + 1
Loop
End Sub
'FIN MACRO COULEURS ALTERNaTIVES |
Partager