1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Function Poisquaille() As Double
' Fonction créée le 13/02/2007 par Sébastien BRUNEL
Dim Poisson(9) As Integer
Dim Commentaire As String
Dim Cellule As Range
For Each Cellule In Range("C14:C2000")
Select Case Cellule
Case "Truite fario"
Poisson(1) = Poisson(1) + Cells(Cellule.Row, 4).Value
Case "Truite arc-en-ciel"
Poisson(2) = Poisson(2) + 1
Case "Chabot"
Poisson(3) = Poisson(3) + 1
Case "Vairon"
Poisson(4) = Poisson(4) + 1
Case "Loche franche"
Poisson(5) = Poisson(5) + 1
Case "Blageon"
Poisson(6) = Poisson(6) + 1
Case "Chevesne"
Poisson(7) = Poisson(7) + 1
Case "Ombre commun"
Poisson(8) = Poisson(8) + 1
Case "Barbeau fluviatil"
Poisson(9) = Poisson(9) + 1
End Select
Next Cellule
For i = 1 To 9
If Poisson(i) <> 0 Then
Poisson(0) = Poisson(0) + 1
End If
Next i
If Not Worksheets(1).Range("J8").Comment Is Nothing Then
Worksheets(1).Range("J8").Comment.Delete
End If
Commentaire = "Truite fario" & Poisson(2) & Chr(13) & "Truite arc-en-ciel" & Poisson(2) & Chr(13) & "Chabot" & Poisson(3) & Chr(13) & "Vairon" & Poisson(4) & Chr(13) & "Loche franche" & Poisson(5) & Chr(13) & "Blageon" & Poisson(6) & Chr(13) & "Chevesne" & Poisson(7) & Chr(13) & "Ombre commun" & Poisson(8) & Chr(13) & "Barbeau fluviatil" & Poisson(9)
With Worksheets(1).Range("J8").AddComment
.Visible = False
.Text Commentaire
End With
Poisquaille = Poisson(0)
End Function |
Partager