View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Rudski[_4_] Tom Rudski[_4_] is offline
external usenet poster
 
Posts: 1
Default Listbox and vba auto filter

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