Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Sheets("Data List").Select
  2.  
  3. With Worksheets("Data List").Range("A1", Sheets("Data List").Range("C1").End(xlDown))
  4. .AutoFilter field:=1, Criteria1:=UserForm1.ListBox3.List(k) 'filter data based on user listbox selection
  5. For j = 0 To UserForm1.ListBox1.ListCount - 1 'Find user selection from LB3 in LB1 to match filtered data order
  6. If UserForm1.ListBox3.List(k) = UserForm1.ListBox1.List(j) Then Exit For
  7. Next j
  8. For h = 0 To UBound(dataArr, 2)
  9. If dataArr(j, h) = 1 Then 'If the user has selected they want this data then add it to the array
  10.  
  11. Set myRange = Sheets("Data List").AutoFilter.Range().SpecialCells(xlCellTypeVisible)
  12. myRange.Select
  13. arr1(l) = myRange.Cells(h + 2, 2)
  14. arr2(l) = myRange.Cells(h + 2, 3)
  15. l = l + 1
  16. End If
  17. Next h
  18. .AutoFilter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement