Bonjour,
j'ai un classeur avec une quarantaine de page.
Je veux en fait un tableau récapitulatif, à chaque fois qu'il trouve l'un
des 4 éléments suivants (EXP, CAC, FI, FC), qui se situent dans la plage
E8:E38 de chaque page, en prenant divers éléments.
Je voudrais, que mon tableau soit structuré comme suit : en colonne A, la
valeur de la cellule C10 de la feuille 1 (texte), en colonne B, la valeur de
la cellule C11 de la feuille 1 (texte) (mais seulement si la colonne C n'est
pas vide)
, en colonne C, les valeurs cherchées (EXP,CAC,FI,FC), en colonne D la
valeur B8:B38 correspondante (date), en colonne E la valeur J8:J38
correspondante (nombre), et en colonne F la valeur L8:L38 correspondante
(texte).
Ext ce possible à faire en macro. il faut en fait faire un test sur toutes
les feuilles, exceptées celle sur laquelle je travail, et copier les infos en
décalant d'une ligne à chaque fois. C'est faisable?
Merci à vous tous.
Yann
Rajout ou effacement ...ça à l'air de fonctionner Youky Sub Récap() Dim ok As Boolean For k = 1 To Sheets.Count If Sheets(k).Name = "Info" Then GoTo saute If Sheets(k).Name = "Formation" Then GoTo saute For Each c In Sheets(k).[E8:E38] If c.Value = "EXP" Then ok = True If c.Value = "CAC" Then ok = True If c.Value = "FI" Then ok = True If c.Value = "FC" Then ok = True If ok = True Then ok = False lig = lig + 1 If Sheets("Formation").Range("D" & lig) > Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Insert Shift:=xlDown Else If Sheets("Formation").Range("D" & lig) < Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Delete End If End If Sheets("Formation").Range("A" & lig) = Sheets("Info").[C10] Sheets("Formation").Range("B" & lig) = Sheets("Info").[C11] Sheets("Formation").Range("C" & lig) = c.Value Sheets("Formation").Range("D" & lig) = Sheets(k).Range("B" & c.Row) Sheets("Formation").Range("E" & lig) = Sheets(k).Range("J" & c.Row) Sheets("Formation").Range("F" & lig) = Sheets(k).Range("L" & c.Row) End If Next saute: Next Sheets("Formation").Columns("D:D").NumberFormat = "dd/mm/yy" End Sub
Rajout ou effacement ...ça à l'air de fonctionner
Youky
Sub Récap()
Dim ok As Boolean
For k = 1 To Sheets.Count
If Sheets(k).Name = "Info" Then GoTo saute
If Sheets(k).Name = "Formation" Then GoTo saute
For Each c In Sheets(k).[E8:E38]
If c.Value = "EXP" Then ok = True
If c.Value = "CAC" Then ok = True
If c.Value = "FI" Then ok = True
If c.Value = "FC" Then ok = True
If ok = True Then
ok = False
lig = lig + 1
If Sheets("Formation").Range("D" & lig) > Sheets(k).Range("B" & c.Row) Then
Sheets("Formation").Rows(lig).Insert Shift:=xlDown
Else
If Sheets("Formation").Range("D" & lig) < Sheets(k).Range("B" & c.Row)
Then
Sheets("Formation").Rows(lig).Delete
End If
End If
Sheets("Formation").Range("A" & lig) = Sheets("Info").[C10]
Sheets("Formation").Range("B" & lig) = Sheets("Info").[C11]
Sheets("Formation").Range("C" & lig) = c.Value
Sheets("Formation").Range("D" & lig) = Sheets(k).Range("B" & c.Row)
Sheets("Formation").Range("E" & lig) = Sheets(k).Range("J" & c.Row)
Sheets("Formation").Range("F" & lig) = Sheets(k).Range("L" & c.Row)
End If
Next
saute:
Next
Sheets("Formation").Columns("D:D").NumberFormat = "dd/mm/yy"
End Sub
Rajout ou effacement ...ça à l'air de fonctionner Youky Sub Récap() Dim ok As Boolean For k = 1 To Sheets.Count If Sheets(k).Name = "Info" Then GoTo saute If Sheets(k).Name = "Formation" Then GoTo saute For Each c In Sheets(k).[E8:E38] If c.Value = "EXP" Then ok = True If c.Value = "CAC" Then ok = True If c.Value = "FI" Then ok = True If c.Value = "FC" Then ok = True If ok = True Then ok = False lig = lig + 1 If Sheets("Formation").Range("D" & lig) > Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Insert Shift:=xlDown Else If Sheets("Formation").Range("D" & lig) < Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Delete End If End If Sheets("Formation").Range("A" & lig) = Sheets("Info").[C10] Sheets("Formation").Range("B" & lig) = Sheets("Info").[C11] Sheets("Formation").Range("C" & lig) = c.Value Sheets("Formation").Range("D" & lig) = Sheets(k).Range("B" & c.Row) Sheets("Formation").Range("E" & lig) = Sheets(k).Range("J" & c.Row) Sheets("Formation").Range("F" & lig) = Sheets(k).Range("L" & c.Row) End If Next saute: Next Sheets("Formation").Columns("D:D").NumberFormat = "dd/mm/yy" End Sub
Sunburn
Re, oui ça fonctionne bien, merci. Mais mon problème, est que je voudrais avoir ma ligne 1 pour pouvoir y inscrire des commentaires par VBA, et figer les volets à partir de la ligne 2. En fait, je voudrais préciser par VBA: A1 = "Nom" B1 = "Prénom" C1 = .....
Et que ça ne s'efface pas. puis figer les volets. Merci. Yann
Re,
oui ça fonctionne bien, merci.
Mais mon problème, est que je voudrais avoir ma ligne 1 pour pouvoir y
inscrire des commentaires par VBA, et figer les volets à partir de la ligne 2.
En fait, je voudrais préciser par VBA:
A1 = "Nom"
B1 = "Prénom"
C1 = .....
Et que ça ne s'efface pas. puis figer les volets.
Merci.
Yann
Re, oui ça fonctionne bien, merci. Mais mon problème, est que je voudrais avoir ma ligne 1 pour pouvoir y inscrire des commentaires par VBA, et figer les volets à partir de la ligne 2. En fait, je voudrais préciser par VBA: A1 = "Nom" B1 = "Prénom" C1 = .....
Et que ça ne s'efface pas. puis figer les volets. Merci. Yann
Youky
Et voici sur un plateau d'argent Youky
Sub Récap() Dim ok As Boolean Sheets("Formation").Range("A1") = "Nom" Sheets("Formation").Range("B1") = "Prénom" Sheets("Formation").Range("C1") = "Motif" Sheets("Formation").Range("D1") = "Date" Sheets("Formation").Range("E1") = "Chiffre" Sheets("Formation").Range("F1") = "Lettre" lig = 1 For k = 1 To Sheets.Count If Sheets(k).Name = "Info" Then GoTo saute If Sheets(k).Name = "Formation" Then GoTo saute For Each c In Sheets(k).[E8:E38] If c.Value = "EXP" Then ok = True If c.Value = "CAC" Then ok = True If c.Value = "FI" Then ok = True If c.Value = "FC" Then ok = True If ok = True Then ok = False lig = lig + 1 If Sheets("Formation").Range("D" & lig) > Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Insert Shift:=xlDown Else If Sheets("Formation").Range("D" & lig) < Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Delete End If End If Sheets("Formation").Range("A" & lig) = Sheets("Info").[C10] Sheets("Formation").Range("B" & lig) = Sheets("Info").[C11] Sheets("Formation").Range("C" & lig) = c.Value Sheets("Formation").Range("D" & lig) = Sheets(k).Range("B" & c.Row) Sheets("Formation").Range("E" & lig) = Sheets(k).Range("J" & c.Row) Sheets("Formation").Range("F" & lig) = Sheets(k).Range("L" & c.Row) End If Next saute: Next Sheets("Formation").Columns("D:D").NumberFormat = "dd/mm/yy" End Sub
"Sunburn" a écrit dans le message de news:
Re, oui ça fonctionne bien, merci. Mais mon problème, est que je voudrais avoir ma ligne 1 pour pouvoir y inscrire des commentaires par VBA, et figer les volets à partir de la ligne 2. En fait, je voudrais préciser par VBA: A1 = "Nom" B1 = "Prénom" C1 = .....
Et que ça ne s'efface pas. puis figer les volets. Merci. Yann
Et voici sur un plateau d'argent
Youky
Sub Récap()
Dim ok As Boolean
Sheets("Formation").Range("A1") = "Nom"
Sheets("Formation").Range("B1") = "Prénom"
Sheets("Formation").Range("C1") = "Motif"
Sheets("Formation").Range("D1") = "Date"
Sheets("Formation").Range("E1") = "Chiffre"
Sheets("Formation").Range("F1") = "Lettre"
lig = 1
For k = 1 To Sheets.Count
If Sheets(k).Name = "Info" Then GoTo saute
If Sheets(k).Name = "Formation" Then GoTo saute
For Each c In Sheets(k).[E8:E38]
If c.Value = "EXP" Then ok = True
If c.Value = "CAC" Then ok = True
If c.Value = "FI" Then ok = True
If c.Value = "FC" Then ok = True
If ok = True Then
ok = False
lig = lig + 1
If Sheets("Formation").Range("D" & lig) > Sheets(k).Range("B" & c.Row) Then
Sheets("Formation").Rows(lig).Insert Shift:=xlDown
Else
If Sheets("Formation").Range("D" & lig) < Sheets(k).Range("B" & c.Row)
Then
Sheets("Formation").Rows(lig).Delete
End If
End If
Sheets("Formation").Range("A" & lig) = Sheets("Info").[C10]
Sheets("Formation").Range("B" & lig) = Sheets("Info").[C11]
Sheets("Formation").Range("C" & lig) = c.Value
Sheets("Formation").Range("D" & lig) = Sheets(k).Range("B" & c.Row)
Sheets("Formation").Range("E" & lig) = Sheets(k).Range("J" & c.Row)
Sheets("Formation").Range("F" & lig) = Sheets(k).Range("L" & c.Row)
End If
Next
saute:
Next
Sheets("Formation").Columns("D:D").NumberFormat = "dd/mm/yy"
End Sub
"Sunburn" <Sunburn@discussions.microsoft.com> a écrit dans le message de
news: 7363DB9F-5703-4AE3-875A-6191BF5A54B7@microsoft.com...
Re,
oui ça fonctionne bien, merci.
Mais mon problème, est que je voudrais avoir ma ligne 1 pour pouvoir y
inscrire des commentaires par VBA, et figer les volets à partir de la
ligne 2.
En fait, je voudrais préciser par VBA:
A1 = "Nom"
B1 = "Prénom"
C1 = .....
Et que ça ne s'efface pas. puis figer les volets.
Merci.
Yann
Sub Récap() Dim ok As Boolean Sheets("Formation").Range("A1") = "Nom" Sheets("Formation").Range("B1") = "Prénom" Sheets("Formation").Range("C1") = "Motif" Sheets("Formation").Range("D1") = "Date" Sheets("Formation").Range("E1") = "Chiffre" Sheets("Formation").Range("F1") = "Lettre" lig = 1 For k = 1 To Sheets.Count If Sheets(k).Name = "Info" Then GoTo saute If Sheets(k).Name = "Formation" Then GoTo saute For Each c In Sheets(k).[E8:E38] If c.Value = "EXP" Then ok = True If c.Value = "CAC" Then ok = True If c.Value = "FI" Then ok = True If c.Value = "FC" Then ok = True If ok = True Then ok = False lig = lig + 1 If Sheets("Formation").Range("D" & lig) > Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Insert Shift:=xlDown Else If Sheets("Formation").Range("D" & lig) < Sheets(k).Range("B" & c.Row) Then Sheets("Formation").Rows(lig).Delete End If End If Sheets("Formation").Range("A" & lig) = Sheets("Info").[C10] Sheets("Formation").Range("B" & lig) = Sheets("Info").[C11] Sheets("Formation").Range("C" & lig) = c.Value Sheets("Formation").Range("D" & lig) = Sheets(k).Range("B" & c.Row) Sheets("Formation").Range("E" & lig) = Sheets(k).Range("J" & c.Row) Sheets("Formation").Range("F" & lig) = Sheets(k).Range("L" & c.Row) End If Next saute: Next Sheets("Formation").Columns("D:D").NumberFormat = "dd/mm/yy" End Sub
"Sunburn" a écrit dans le message de news:
Re, oui ça fonctionne bien, merci. Mais mon problème, est que je voudrais avoir ma ligne 1 pour pouvoir y inscrire des commentaires par VBA, et figer les volets à partir de la ligne 2. En fait, je voudrais préciser par VBA: A1 = "Nom" B1 = "Prénom" C1 = .....
Et que ça ne s'efface pas. puis figer les volets. Merci. Yann