Good morning folks,
I'm new here and have only 'google level' experience of VBA, and although I usually manage to cobble together a code to get it to do what I want, this time I'm really struggling.
I have a huge set of data relating to past travels which I want to convert each time I export the data to another workbook. I've included a picture of how the data currently looks, and how I would like it to look once I've run the VBA code.
The data lists hundreds of journeys. Some journeys were direct, but some journeys are "from A to C via B" etc.
I'm looking for VBA that will count the rows, then cycle through each row of data and where there is an entry in the via field (column F in this instance), it will insert a row below this, copy all of the data from Columns A, B and C then essentially manipulate the data in columns D, E and F.
As an example: a record for a journey from D to E via F, will become two records, one from D to F, the second from F to E.
I'm guessing the latter part of the code will involve using "activecell.value" and "offset" but try as I might, I just can't get it to work. I've had success with inserting rows based on criteria before, but I simply can't pull together inserting rows and manipulating the data.
The top row contains column headings.
I hope this all makes sense although I'll be more than happy to provide further explanations if needed.
I'd really appreciate any assistance that anyone can offer, and my sincerest thanks in advance for taking the time out of your day to help if you can.
Best regards, Stu
I'm new here and have only 'google level' experience of VBA, and although I usually manage to cobble together a code to get it to do what I want, this time I'm really struggling.
I have a huge set of data relating to past travels which I want to convert each time I export the data to another workbook. I've included a picture of how the data currently looks, and how I would like it to look once I've run the VBA code.
The data lists hundreds of journeys. Some journeys were direct, but some journeys are "from A to C via B" etc.
I'm looking for VBA that will count the rows, then cycle through each row of data and where there is an entry in the via field (column F in this instance), it will insert a row below this, copy all of the data from Columns A, B and C then essentially manipulate the data in columns D, E and F.
As an example: a record for a journey from D to E via F, will become two records, one from D to F, the second from F to E.
I'm guessing the latter part of the code will involve using "activecell.value" and "offset" but try as I might, I just can't get it to work. I've had success with inserting rows based on criteria before, but I simply can't pull together inserting rows and manipulating the data.
The top row contains column headings.
I hope this all makes sense although I'll be more than happy to provide further explanations if needed.
I'd really appreciate any assistance that anyone can offer, and my sincerest thanks in advance for taking the time out of your day to help if you can.
Best regards, Stu