Bonjour,
J'ai créé une macro simpliste pour calculer un taux de réponse. Dans le fichier, les personnes ayant répondu sont en gras et sont rajoutées au fur et à mesure. La macro fonctionnait correctement jusqu'à récemment où l'ajout d'un n-ième nom en gras me l'a fait planter sans que je comprenne pourquoi.
Merci par avance pour vos éclaircissements.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 Sub Taux_reponse() Dim Cel As Range, total As Long, reponse As Long, taux As Double reponse = 0 For Each Cel In ActiveSheet.Range("A2:A1032") If Cel.Font.Bold = True Then reponse = reponse + 1 End If Next total = 0 For Each Cel In ActiveSheet.Range("A2:A1032") If Cel.Value = "oui" Then total = total + 1 End If Next taux = (reponse * 100) / total MsgBox " le taux de réponse est : " & taux & " %" End Sub
Partager