The file homework8.xlsx contains a list of flight information in columns A, B, and C.
The list includes origin, destination, and flight #s of each flight.
You are interested in flights that leave from any city in column E and end up at any city in column F. You need to list such flights in columns H, I, and J with their respective data. (see below for example)
Write a VBA program using 1 dimensional arrays to do this.
Your code should work even if the lists change.
Count the number of flights in Column A
Counts the number of flightOrigins (column E) in the origin search list.
Counts the number of flightDestinations (column F) in the destination search list.
Redimension all arrays (for flights and for searches) - remember the # of flights may change.
Captures the flight information in columns A to C in spearate arrays.
Captures the search information in columns E and F in separate arrays.
Initializes the number of matches seen so far to 0.
Go through all combinations of search origins and search destinations.
Go through all flights and search for matches
When a match has been found. Update the number of matches found so far, then record the information on this flight in columns H to J.
Create a button on the spreadsheet to run the app
Create a button on the spreadsheet to clear the results in columns H to J
Solved by M. Q. in 18 mins