Hi Everyone,
OK, I have a Spread sheet with a userform which has a list box listing unique numbers for a certain column (column B).
I have manged to set it up so that when I Select a number fro the list box and press the command button the macro basically filters the worksheet and only displays the data row of the selected number (from the listbox).
Wha I need to do is expand on this so that I can allow the user to select multipl numbers from the list box and when the command button is pressed the macro will display the rows for the selection (if that makes sense?)
I have placed the code I have put together so far below,
Any help would be much appreciated.
OK, I have a Spread sheet with a userform which has a list box listing unique numbers for a certain column (column B).
I have manged to set it up so that when I Select a number fro the list box and press the command button the macro basically filters the worksheet and only displays the data row of the selected number (from the listbox).
Wha I need to do is expand on this so that I can allow the user to select multipl numbers from the list box and when the command button is pressed the macro will display the rows for the selection (if that makes sense?)
I have placed the code I have put together so far below,
Any help would be much appreciated.
Code:
Private Sub CommandButton1_Click()
Sheets("Mar").Range("B4:B100").AutoFilter
ActiveSheet.Range("$B$4:$O$100").AutoFilter Field:=1, Criteria1:=ListBox1.List
End Sub
Private Sub CommandButton2_Click()
ActiveSheet.Range("$A$2:$D$6").AutoFilter Field:=1
Rows("4:4").Select
Selection.AutoFilter
Range("A1").Select
End Sub