BaffledOfBristol
New Member
- Joined
- Dec 24, 2013
- Messages
- 13
My VBA/macro writing is a little rusty and I need to consolidate multiple rows into one row and then delete the old rows. My vehicle table has 1 row per bus per month. What I am trying to do is change the file so it contains only one row per bus with the monthly data in new columns.
The current columns are as follows (many rows per bus). The underlined columns are static/repeating for each monthly bus row. In bold are the columns that do change per bus per month :-
FLEET NO
REGISTRATION NO
VEHICLE TYPE
MODEL
COMPANY
ALLOCATED DEPOT
CLOSING ODOMETER
ODOMETER DAT
ODOMETER UNIT
FUEL USED IN PERIOD
MILES IN PERIOD
BSOG ELIGIBILITY
What I would like to do is have the data re-arranged as per the following columns with 1 row per bus:-
FLEET NO
REGISTRATION NO
VEHICLE TYPE
MODEL
COMPANY
ALLOCATED DEPOT
CLOSING ODOMETER1
ODOMETER DAT1
FUEL USED IN PERIOD1
MILES IN PERIOD1
CLOSING ODOMETER2
ODOMETER DAT2
FUEL USED IN PERIOD2
MILES IN PERIOD2
....
....
....
CLOSING ODOMETERn
ODOMETER DATn
FUEL USED IN PERIODn
MILES IN PERIODn
ODOMETER UNIT
BSOG ELIGIBILITY
It would be great if I could also order the repeating 'n' group of columns chronologically . Is this possible? The ODOMETER_DAT is in dd/mm/yyyy format.
The monthly data for the buses is not consistent i.e. the buses could have anywhere from one months data (i.e. 1 row) to a years worth (i.e. 12 rows). FLEETNO is the unique identifier for the bus.
Can anyone help please? Many thanks.
The current columns are as follows (many rows per bus). The underlined columns are static/repeating for each monthly bus row. In bold are the columns that do change per bus per month :-
FLEET NO
REGISTRATION NO
VEHICLE TYPE
MODEL
COMPANY
ALLOCATED DEPOT
CLOSING ODOMETER
ODOMETER DAT
ODOMETER UNIT
FUEL USED IN PERIOD
MILES IN PERIOD
BSOG ELIGIBILITY
What I would like to do is have the data re-arranged as per the following columns with 1 row per bus:-
FLEET NO
REGISTRATION NO
VEHICLE TYPE
MODEL
COMPANY
ALLOCATED DEPOT
CLOSING ODOMETER1
ODOMETER DAT1
FUEL USED IN PERIOD1
MILES IN PERIOD1
CLOSING ODOMETER2
ODOMETER DAT2
FUEL USED IN PERIOD2
MILES IN PERIOD2
....
....
....
CLOSING ODOMETERn
ODOMETER DATn
FUEL USED IN PERIODn
MILES IN PERIODn
ODOMETER UNIT
BSOG ELIGIBILITY
It would be great if I could also order the repeating 'n' group of columns chronologically . Is this possible? The ODOMETER_DAT is in dd/mm/yyyy format.
The monthly data for the buses is not consistent i.e. the buses could have anywhere from one months data (i.e. 1 row) to a years worth (i.e. 12 rows). FLEETNO is the unique identifier for the bus.
Can anyone help please? Many thanks.