Within the same workbook I have several sheets/pages with varios data.
In one Sheet I have a simple multiselect listbox wich sums up each colums values into separate cells.
My problem:
Everything works well as long as I have data and listbox on the same page, but when I put the listbox and the data table on separate pages (I´m still directing the listbox to the data table via the listbox properties dialog and ListFillRange ) I can still view and select any list object but summarys are no longer done in the cells that are supposed to sum up each column, they just get 0 as value.
My code:
[vba]
Private Sub ListBox1_Change()
Dim i As Integer
Range("B17") = 0
Range("C17") = 0
Range("D17") = 0
Range("E17") = 0
Range("F17") = 0
Range("G17") = 0
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Range("B17") = Range("B17") + Cells(i + 21, 38)
Range("C17") = Range("C17") + Cells(i + 21, 40)
Range("D17") = Range("D17") + Cells(i + 21, 42)
Range("E17") = Range("E17") + Cells(i + 21, 44)
Range("F17") = Range("F17") + Cells(i + 21, 46)
Range("G17") = Range("G17") + Cells(i + 21, 48)
End If
Next i
End Sub
[/vba]
Any help would be greatly appriciated!
And please excuse my english as it's not my native language.