Dears,
How can I search for a value in a TXT file and return its correspondence in an Array?
In my Excel Spreadsheet, on cell A1, the user will type the airport code, like SBKP for example. It's always a 4 digit string.
Then, the VBA code will check if there is the airport SBKP into my TXT file, called airports.txt, if the airport was there, the VBA code will collect all information about this airport, otherwise the VBA code will return the message "INCORRECT AIRPORT" on cell A2.
The airports.txt file has the airports listed like - and I've about 3000 airports listed there:
A|SBKG|PRESIDENTE JOAO SUASSUNA|-7269167|-35895000|1646
R|15|147|5249|1|109100|147|-7265528|-35901833|1608|300|50
R|33|327|5249|0|0|0|-7273833|-35889972|1646|300|50
A|SBKP|VIRACOPOS INTL|-23006944|-47134444|2170
R|15|149|10630|1|110300|148|-22998467|-47147003|2139|300|51
R|33|329|10630|0|0|0|-23016372|-47121997|2170|300|50
A|SBLE|HORACIO DE MATTOS|-12482222|-41276944|1660
R|14|140|6831|0|0|0|-12482222|-41276944|1660|300|50
R|32|320|6831|0|0|0|-12482222|-41276944|1660|300|50
As you can see, the separator is "|", so when the airport is find, the VBA Code will have to collect all the following information:
A|SBKP|VIRACOPOS INTL|-23006944|-47134444|2170
R|15|149|10630|1|110300|148|-22998467|-47147003|2139|300|51
R|33|329|10630|0|0|0|-23016372|-47121997|2170|300|50
And store the first line it into an array called: Origin_Airport
Sometimes the number of Lines is bigger than 3, the first line corresponds to the airport line, the second, third, fourth and so on... corresponds to the number of runways available.
Can you help me guys?
Thank you so much
How can I search for a value in a TXT file and return its correspondence in an Array?
In my Excel Spreadsheet, on cell A1, the user will type the airport code, like SBKP for example. It's always a 4 digit string.
Then, the VBA code will check if there is the airport SBKP into my TXT file, called airports.txt, if the airport was there, the VBA code will collect all information about this airport, otherwise the VBA code will return the message "INCORRECT AIRPORT" on cell A2.
The airports.txt file has the airports listed like - and I've about 3000 airports listed there:
A|SBKG|PRESIDENTE JOAO SUASSUNA|-7269167|-35895000|1646
R|15|147|5249|1|109100|147|-7265528|-35901833|1608|300|50
R|33|327|5249|0|0|0|-7273833|-35889972|1646|300|50
A|SBKP|VIRACOPOS INTL|-23006944|-47134444|2170
R|15|149|10630|1|110300|148|-22998467|-47147003|2139|300|51
R|33|329|10630|0|0|0|-23016372|-47121997|2170|300|50
A|SBLE|HORACIO DE MATTOS|-12482222|-41276944|1660
R|14|140|6831|0|0|0|-12482222|-41276944|1660|300|50
R|32|320|6831|0|0|0|-12482222|-41276944|1660|300|50
As you can see, the separator is "|", so when the airport is find, the VBA Code will have to collect all the following information:
A|SBKP|VIRACOPOS INTL|-23006944|-47134444|2170
R|15|149|10630|1|110300|148|-22998467|-47147003|2139|300|51
R|33|329|10630|0|0|0|-23016372|-47121997|2170|300|50
And store the first line it into an array called: Origin_Airport
Sometimes the number of Lines is bigger than 3, the first line corresponds to the airport line, the second, third, fourth and so on... corresponds to the number of runways available.
Can you help me guys?
Thank you so much