Hello All,
I have recorded (that's all I can do ) a macro that filters a set of data. At the moment it filters a set of vehicles and a set of locations. But my problem is that on daily basis, different vehicles may go to the location that is required. Thus I end up manually changing the selection of vehicles that have gone to a particular location (AVA in my case). Can I please get someone to look at the code below and tell me how I can get it to first make a list of vehicles that have "AVA" as one of the locations in the data and then create filters based on this list of vehicles.
The code is:
Thanks and Regards
Asad
I have recorded (that's all I can do ) a macro that filters a set of data. At the moment it filters a set of vehicles and a set of locations. But my problem is that on daily basis, different vehicles may go to the location that is required. Thus I end up manually changing the selection of vehicles that have gone to a particular location (AVA in my case). Can I please get someone to look at the code below and tell me how I can get it to first make a list of vehicles that have "AVA" as one of the locations in the data and then create filters based on this list of vehicles.
The code is:
Code:
Sub AVA()With ActiveSheet
Dim rwnm As Long
rwnm = Range("A" & Rows.Count).End(xlUp).Row
On Error Resume Next
ActiveSheet.ShowAllData
ActiveSheet.Range("A1:H" & rwnm).AutoFilter Field:=8, Criteria1:=Array( _
"AVA", "SXS", "Depot"), Operator:= _
xlFilterValues
ActiveSheet.Range("A1:H" & rwnm).AutoFilter Field:=2, Criteria1:=Array( _
"150", "151", "152", "153", "50", "52", "53", "54", "8", "9"), _
Operator:=xlFilterValues
Range("A1").Select
End With
End Sub
Thanks and Regards
Asad
Last edited: