Typen unverträglich --> warum ?
10.04.2008 10:51:31
FM
ich habe ein kleines Problem mit einer worksheet function.
Ich möchte von einem Skript aus bestimmte Werte summieren wenn 2 Kritieren erfüllt sind ("22" und das jeweilige Land das ausgelesen wird). Als Fehlermeldung bekomme ich "Typen unverträgelich".
Ich komme allerdings nicht darauf wie ich die Variablen sonst deklarieren sollte...
Wäre für jegliche Hilfe dankbar.
Gruss
FM
(P.S. anzzeilen ist als public deklariert und dort als Integer)
Sub countries()
Dim cells_country As Integer
Dim v_country, total_country As Long
Dim country_name As String
AnzZeilen = ThisWorkbook.Worksheets(1).Cells(Rows.Count, 3).End(xlUp).Row - 1
For cells_country = 2 To 14 Step 1
country_name = ThisWorkbook.Worksheets("data").Cells(cells_country, 7).Value
v_country = WorksheetFunction.SumProduct((ThisWorkbook.Worksheets("data").Range("a2:a500") = " _
_
22") * _
(ThisWorkbook.Worksheets("data").Range("d2:d500") = country_name) * _
ThisWorkbook.Worksheets("data").Range("b2:b500"))
Next cells_country
End Sub