- 100 名前:デフォルトの名無しさん [2007/06/05(火) 09:38:09 ]
- リストの選択要素の合計を求めるのだったらこんな感じかな?
横槍だけど。 Private Sub Command2_Click() Dim a As Integer Dim b() As Integer '配列 Dim c As Integer '要素数 Dim sum As Integer For a = 0 To List1.ListCount - 1 If List1.Selected(a) = True Then ReDim Preserve b(c) b(c) = List1.List(a) c = c + 1 End If Next sum = SumCalc(b) ’配列を渡して要素数の合計を返す End Sub Private Function SumCalc(ByRef b() As Integer) As Integer Dim f As Integer Dim sum As Integer For f = 0 To UBound(b) sum = sum + b(f) Next SumCalc = sum End Function
|

|