Data migration between sheets

drop05

Active Member
Joined
Mar 23, 2021
Messages
285
Office Version
  1. 365
Platform
  1. Windows
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
kEnt1.PNG

Continued sheet1 showing 2nd entries
kEnt2.PNG


Sheet2:
X ex.PNG
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top