XL 2016 formule vba 1+1

Guismo33

XLDnaute Occasionnel
Bonjour à tous,

formule : Worksheets("Recap").Cells(5 + i, 3) = (Cells(4 + i, 22) > 3) + 1

dans la feuille viens mettre l'infos "1", mais je voudrais faire 1 + 1 pourriez vous m'aider merci.



bien à vous
 

Guismo33

XLDnaute Occasionnel
Bonjour..
un peu léger comme explication de ce que tu veux faire...
un fichier exemple, et un peu plus qu'une ligne de code.. seraient les bienvenus

i= combien?
pourquoi ce test: >3 ??
qui te donnera soit 2 soit 1
Bonjour,
ci joint fichier , merci pour votre aide.

Bien à vous
Bonjour..
un peu léger comme explication de ce que tu veux faire...
un fichier exemple, et un peu plus qu'une ligne de code.. seraient les bienvenus

i= combien?
pourquoi ce test: >3 ??
qui te donnera soit 2 soit 1
Bonjour,
ci joint fichier , merci pour votre aide.

Bien à vous
 

Pièces jointes

  • Compte 1+1.xlsm
    29.9 KB · Affichages: 17
  • Compte 1+1.xlsm
    29.9 KB · Affichages: 15
  • Compte 1+1.xlsx
    25.8 KB · Affichages: 14
  • Compte 1+1.xlsm
    29.9 KB · Affichages: 14
  • Compte 1+1.xlsx
    25.8 KB · Affichages: 15

vgendron

XLDnaute Barbatruc
Hello
5 fichiers.. je suppose que c'est toujours le meme..??
sinon.. il va falloir expliquer la logique pour passer des tablo de la feuille pronostic au tablo de la feuille Recap

1) déjà. donner un vrai nom aux tables.. pour pouvoir profiter de leurs avantages et s'y retrouver plus facilement
2) je suppose que dans ton code. tu regardes le contenu du tablo vert (que j'ai appelé TabResult)
et selon les valeurs tu mets un +1 dans la feuille Recap (TabRecap)
3) que la valeur soit 3 4 5 ou ...8 . dans ta feuille Recap. tu as toujours un 1 ?
les valeurs remplies dans ta feuille Recap. c'est ce que tu attends, ou juste ce que tu as réussi à faire mais qui ne convient pas?
 
Dernière édition:

vgendron

XLDnaute Barbatruc
Sinon. ton code devrait donner ceci - si j'ai bien compris..

VB:
Sub Compte_nombres_t_q_qt()
Application.ScreenUpdating = False
Dim i As Integer
Set WSRecap = Sheets("Recap")
Set WSPron = Sheets("Pronostic")

With WSRecap
    For i = 1 To 31
        If (Cells(4 + i, 22) > 3) Then .Cells(5 + i, 3) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 4) Then .Cells(5 + i, 4) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 5) Then .Cells(5 + i, 5) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 6) Then .Cells(5 + i, 6) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 7) Then .Cells(5 + i, 7) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 8) Then .Cells(5 + i, 8) = Cells(4 + i, 22) + 1

        If (Cells(4 + i, 23) <> 4) Then .Cells(5 + i, 10) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 5) Then .Cells(5 + i, 11) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 6) Then .Cells(5 + i, 12) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 7) Then .Cells(5 + i, 13) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 8) Then .Cells(5 + i, 14) = Cells(4 + i, 23) + 1

        If (Cells(4 + i, 24) <> 5) Then .Cells(5 + i, 16) = Cells(4 + i, 24) + 1
        If (Cells(4 + i, 24) <> 6) Then .Cells(5 + i, 17) = Cells(4 + i, 24) + 1
        If (Cells(4 + i, 24) <> 7) Then .Cells(5 + i, 18) = Cells(4 + i, 24) + 1
        If (Cells(4 + i, 24) <> 8) Then .Cells(5 + i, 19) = Cells(4 + i, 24) + 1
    Next i
End With
End Sub
 

Guismo33

XLDnaute Occasionnel
Sinon. ton code devrait donner ceci - si j'ai bien compris..

VB:
Sub Compte_nombres_t_q_qt()
Application.ScreenUpdating = False
Dim i As Integer
Set WSRecap = Sheets("Recap")
Set WSPron = Sheets("Pronostic")

With WSRecap
    For i = 1 To 31
        If (Cells(4 + i, 22) > 3) Then .Cells(5 + i, 3) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 4) Then .Cells(5 + i, 4) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 5) Then .Cells(5 + i, 5) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 6) Then .Cells(5 + i, 6) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 7) Then .Cells(5 + i, 7) = Cells(4 + i, 22) + 1
        If (Cells(4 + i, 22) <> 8) Then .Cells(5 + i, 8) = Cells(4 + i, 22) + 1

        If (Cells(4 + i, 23) <> 4) Then .Cells(5 + i, 10) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 5) Then .Cells(5 + i, 11) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 6) Then .Cells(5 + i, 12) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 7) Then .Cells(5 + i, 13) = Cells(4 + i, 23) + 1
        If (Cells(4 + i, 23) <> 8) Then .Cells(5 + i, 14) = Cells(4 + i, 23) + 1

        If (Cells(4 + i, 24) <> 5) Then .Cells(5 + i, 16) = Cells(4 + i, 24) + 1
        If (Cells(4 + i, 24) <> 6) Then .Cells(5 + i, 17) = Cells(4 + i, 24) + 1
        If (Cells(4 + i, 24) <> 7) Then .Cells(5 + i, 18) = Cells(4 + i, 24) + 1
        If (Cells(4 + i, 24) <> 8) Then .Cells(5 + i, 19) = Cells(4 + i, 24) + 1
    Next i
End With
End Sub
Bonjour,

merci pour ton aide, a force de chercher j'ai trouver, voici la formule je n'y es pas penser avant.

Worksheets("Recap").Cells(5 + i, 3) = .Cells(5 + i, 3)+(Cells(4 + i, 22) > 3) + 1


Bien a vous
 

Discussions similaires

Statistiques des forums

Discussions
312 104
Messages
2 085 327
Membres
102 862
dernier inscrit
Emma35400