Aleccharmilles
XLDnaute Nouveau
Bonjour,
suite à une après midi passée à chercher une solution sur les différents blogs, je me résigne à poser la question directement!
novice en VBA, je cherche à insérer une condition que voici:
si la valeur de telle cellule (qui comprends une date) est comprise entre telle cellule (date) et celle ci (date), alors...
voici ma formule pour le moment: (partie recherchée en gras).
elle comporte donc trois conditions.
Function TableauDeBordTA()
Dim h As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
h = 4
i = 5
j = 16
k = 16
Range("A16:A99999").Clear
Range("B16:B99999").Clear
Range("C16:C99999").Clear
Range("E16:E99999").Clear
Range("F16:F99999").Clear
Range("G16:G99999").Clear
FacturesEncaisséesTA:
While Feuil5.cells(j, 3) <> ""
j = j + 1
Wend
While Feuil4.cells(i, 3) <> ""
If Feuil4.cells(i, 1) = "XXXX" Then
'c'est celle ci que je cherche a créer: (et qui ne fonctionne pas...)
if cdate(feuil5.cells(8,6))<=cdate(feuil4.cells(i,2))<cdate(feuil5.cells(9,6)) then
If Feuil4.cells(i, 11) = "OUI" Then
Feuil5.cells(j, 3) = Feuil4.cells(i, 8)
Feuil5.cells(j, 2) = Feuil4.cells(i, 4)
Feuil5.cells(j, 1) = Feuil4.cells(i, 2)
End If
End if
End If
i = i + 1
GoTo FacturesEncaisséesTA
Wend
CreancesClientsTA:
While Feuil5.cells(k, 7) <> ""
k = k + 1
Wend
While Feuil4.cells(h, 7) <> ""
If Feuil4.cells(h, 1) = "XXXX" Then
if cdate(feuil5.cells(8,6))<=cdate(feuil4.cells(i,2))<cdate(feuil5.cells(9,6)) then
If Feuil4.cells(h, 11) = "NON" Then
Feuil5.cells(k, 7) = Feuil4.cells(h, 8)
Feuil5.cells(k, 6) = Feuil4.cells(h, 4)
Feuil5.cells(k, 5) = Feuil4.cells(h, 2)
End If
If Feuil4.cells(h, 11) = "" Then
Feuil5.cells(k, 7) = Feuil4.cells(h, 8)
Feuil5.cells(k, 6) = Feuil4.cells(h, 4)
Feuil5.cells(k, 5) = Feuil4.cells(h, 2)
End If
End if
End If
h = h + 1
GoTo CreancesClientsTA
Wend
End Function
merci beaucoup par avance de l'aide que vous m'apporterez
Aleccharmilles
suite à une après midi passée à chercher une solution sur les différents blogs, je me résigne à poser la question directement!
novice en VBA, je cherche à insérer une condition que voici:
si la valeur de telle cellule (qui comprends une date) est comprise entre telle cellule (date) et celle ci (date), alors...
voici ma formule pour le moment: (partie recherchée en gras).
elle comporte donc trois conditions.
Function TableauDeBordTA()
Dim h As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
h = 4
i = 5
j = 16
k = 16
Range("A16:A99999").Clear
Range("B16:B99999").Clear
Range("C16:C99999").Clear
Range("E16:E99999").Clear
Range("F16:F99999").Clear
Range("G16:G99999").Clear
FacturesEncaisséesTA:
While Feuil5.cells(j, 3) <> ""
j = j + 1
Wend
While Feuil4.cells(i, 3) <> ""
If Feuil4.cells(i, 1) = "XXXX" Then
'c'est celle ci que je cherche a créer: (et qui ne fonctionne pas...)
if cdate(feuil5.cells(8,6))<=cdate(feuil4.cells(i,2))<cdate(feuil5.cells(9,6)) then
If Feuil4.cells(i, 11) = "OUI" Then
Feuil5.cells(j, 3) = Feuil4.cells(i, 8)
Feuil5.cells(j, 2) = Feuil4.cells(i, 4)
Feuil5.cells(j, 1) = Feuil4.cells(i, 2)
End If
End if
End If
i = i + 1
GoTo FacturesEncaisséesTA
Wend
CreancesClientsTA:
While Feuil5.cells(k, 7) <> ""
k = k + 1
Wend
While Feuil4.cells(h, 7) <> ""
If Feuil4.cells(h, 1) = "XXXX" Then
if cdate(feuil5.cells(8,6))<=cdate(feuil4.cells(i,2))<cdate(feuil5.cells(9,6)) then
If Feuil4.cells(h, 11) = "NON" Then
Feuil5.cells(k, 7) = Feuil4.cells(h, 8)
Feuil5.cells(k, 6) = Feuil4.cells(h, 4)
Feuil5.cells(k, 5) = Feuil4.cells(h, 2)
End If
If Feuil4.cells(h, 11) = "" Then
Feuil5.cells(k, 7) = Feuil4.cells(h, 8)
Feuil5.cells(k, 6) = Feuil4.cells(h, 4)
Feuil5.cells(k, 5) = Feuil4.cells(h, 2)
End If
End if
End If
h = h + 1
GoTo CreancesClientsTA
Wend
End Function
merci beaucoup par avance de l'aide que vous m'apporterez
Aleccharmilles
Dernière édition: