Listbox and vba auto filter

G

Guest

XL2K3 Listbox
A B C D
RG 1 8 9
8P 2 1 3
Total 12

RG 1 8
2P
8P 2 1
7P

The top rows above 'Total' are a List box (filtered).
below 'Total' are rows with value (RG,2P) summing up to the ListBox.
I recorded a macro and copied it into:

Private Sub Worksheet_Change(ByVal Target As Range)
If xx > 0 Then
xx = 0
On Error GoTo 0
Exit Sub
End If
xx = 0
On Error Resume Next
Range("E4").Select
Worksheets("sheet 1").ShowAllData
On Error GoTo 0
Range("E4").Select
xx = 1
Selection.AutoFilter Field:=4, Criteria1:=">0", Operator:=xlAnd
' range("C11").Select
End Sub

This works, but the ListBox stays active and the List box filter does not
filter until after I select another cell outside the List box.

Can a List Box be automated like this or do you need to loop through using
'long hand' VBA counts and items....
Any Help appreciated.
TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top