1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub Vol()
Dim pptaire As String, lieu As String, parcelle As String, Vol As Double, dl As Long, rep As Single
'Détermination des données Propriétaire, commune et parcelle
pptaire = Application.InputBox(prompt:="Propriétaire :", Title:="Choix du Propriétaire.", Type:=3)
lieu = Application.InputBox(prompt:="Lieu :", Title:="Commune de la Forêt", Type:=3)
parcelle = Application.InputBox(prompt:="Parcelle :", Title:="Parcelle forestière", Type:=3)
' Calcul des volumes
With Worksheets("BD")
dl = .Range("A" & .Rows.Count).End(xlUp).Row
Vol = Application.WorksheetFunction.SumProduct((.Range("P2:P" & dl) = pptaire) * (.Range("M2:M" & dl)) * 1)
End With
rep = MsgBox(Vol, vbOKOnly + vbInformation, "Volume:")
End Sub |
Partager