Hello, I am stumped. I am trying to come up with code that migrates data using VBA.
below i will share some screen shots to hopefully describe the situation better. So this first two pictures are sheet1 and the data points i want to move to sheet2 which is the third picture. The way it works is with column D, that |1 / 2|1 or |2 / 2|2, these numbers in front of the | is the detail number, so i know in the screen shot it only shows 2, but i have a button that can add more if needed which will copy those 5 detail rows and paste them after creating a 3|#, 4|# and so on. creating a for instance, partners_name_3|1. Those values with the |1 will go into sheet 2 on column F starting at row 163 where name to name, address to address, and so on, and i have filled in sheet 2 with what data points are needed to go where. With the second screen shot is the same but is another entry which you will see a |2, this means a second entry for this batch. would want the same thing to happen with the copying and pasting of data but these will go into column G of sheet2 as shown with the data entered. Now there can be a |3 section so a 3rd entry in this first batch, but just showed 2 since the logic should be there, but say there is not.
Then Now would want the code to go to H in sheet1 and do the same, however with it being started at |1 it will not go to F in sheet 2 like the G column from sheet1 did, because now that will have data in it. so instead it will take into consideration that column F and G in sheet2 have info and then go into column H and if H has a second entry ie a |2 in column D entry in this second batch then that will go in column I and if it had a 3rd entry ie |3 then column J and so on.
So if sheet1 has |1 and |2 and |3 entries in column G then goes to F and G and H and all the details inside. If H in sheet1 has 1| then goes into col I in sheet2, if I in sheet1 has |1 and |2 then goes into Col J and K in sheet2
there can be situation where its different, sheet1 col G has |1 entry, then goes into col F in sheet2, sheet1 col H has |1 |2 |3 entries so goes into sheet 2 G H and I, sheet1 col I has |1 |2 entries then goes into J and K.
Hopefully i explained it well and can see why I am having trouble trying to think of a way to get this accomplished. I am some what new to VBA and would like to get help with the first half so i can work it with other sections of these sheets. These details are related to sch 1 but i also have sch 1A, 1B, sch 2, etc to work with but if i had some logic to reference im sure i can finish those.
Thank you everyone in advance! It is much appreciated!
sheet1 showing first entries
Continued sheet1 showing 2nd entries
Sheet2:
below i will share some screen shots to hopefully describe the situation better. So this first two pictures are sheet1 and the data points i want to move to sheet2 which is the third picture. The way it works is with column D, that |1 / 2|1 or |2 / 2|2, these numbers in front of the | is the detail number, so i know in the screen shot it only shows 2, but i have a button that can add more if needed which will copy those 5 detail rows and paste them after creating a 3|#, 4|# and so on. creating a for instance, partners_name_3|1. Those values with the |1 will go into sheet 2 on column F starting at row 163 where name to name, address to address, and so on, and i have filled in sheet 2 with what data points are needed to go where. With the second screen shot is the same but is another entry which you will see a |2, this means a second entry for this batch. would want the same thing to happen with the copying and pasting of data but these will go into column G of sheet2 as shown with the data entered. Now there can be a |3 section so a 3rd entry in this first batch, but just showed 2 since the logic should be there, but say there is not.
Then Now would want the code to go to H in sheet1 and do the same, however with it being started at |1 it will not go to F in sheet 2 like the G column from sheet1 did, because now that will have data in it. so instead it will take into consideration that column F and G in sheet2 have info and then go into column H and if H has a second entry ie a |2 in column D entry in this second batch then that will go in column I and if it had a 3rd entry ie |3 then column J and so on.
So if sheet1 has |1 and |2 and |3 entries in column G then goes to F and G and H and all the details inside. If H in sheet1 has 1| then goes into col I in sheet2, if I in sheet1 has |1 and |2 then goes into Col J and K in sheet2
there can be situation where its different, sheet1 col G has |1 entry, then goes into col F in sheet2, sheet1 col H has |1 |2 |3 entries so goes into sheet 2 G H and I, sheet1 col I has |1 |2 entries then goes into J and K.
Hopefully i explained it well and can see why I am having trouble trying to think of a way to get this accomplished. I am some what new to VBA and would like to get help with the first half so i can work it with other sections of these sheets. These details are related to sch 1 but i also have sch 1A, 1B, sch 2, etc to work with but if i had some logic to reference im sure i can finish those.
Thank you everyone in advance! It is much appreciated!
sheet1 showing first entries
Continued sheet1 showing 2nd entries
Sheet2: