A
AIZ
Guest
bonjour,
la macro suivante ne marche que si l'on indique le pourcentage de AK2 et l'on a en automatique AK3 or si je cherche AK2 et que j'ai déja le pourcentage de AK3 alors cela ne marche pas.
Quelqu'un aurai il une solution?
Sub pourcent()
colak = Range('AK1').Column
For Each c In Range('C3:C5249')
tot = 0
If c = Cells(c.Row - 1, c.Column) And Cells(c.Row, colak) = '' Then
For n = 1 To 10
If Cells(c.Row - n, c.Column) = c Then
tot = tot + Cells(c.Row - n, colak)
Else
Cells(c.Row, colak) = 100 - tot
Exit For
End If
Next
End If
Next
End Sub
la macro suivante ne marche que si l'on indique le pourcentage de AK2 et l'on a en automatique AK3 or si je cherche AK2 et que j'ai déja le pourcentage de AK3 alors cela ne marche pas.
Quelqu'un aurai il une solution?
Sub pourcent()
colak = Range('AK1').Column
For Each c In Range('C3:C5249')
tot = 0
If c = Cells(c.Row - 1, c.Column) And Cells(c.Row, colak) = '' Then
For n = 1 To 10
If Cells(c.Row - n, c.Column) = c Then
tot = tot + Cells(c.Row - n, colak)
Else
Cells(c.Row, colak) = 100 - tot
Exit For
End If
Next
End If
Next
End Sub