Using VBA to transfer static data

Smurphster16

New Member
Joined
Feb 28, 2019
Messages
25
Hi guys

I am looking to create a macro which essentially copy data from one workbook to another.

The data is organised by ID numbers for which there are specific data points. The ID’s in both workbooks are organised vertically in one column with the data points for each ID in the same row as the relevant ID in the columns to the right

My initial idea was to loop an offset function to work through each ID in the workbook I want to copy the data to and assign the current ID as a variable then go into the original workbook and use the find function to locate the relevant ID/variable in the workbook holding the data grab the relevant data points for that ID (again using offset functions - But this time horizontal offsets) from the row containing the relevant ID and then paste it into the destination workbook

With my initial attempt I was unsure how to loop the offset function with every ID in the destination workbook and the find function didn’t seem to work across workbooks (I have used it effectively before across worksheets)

Could anyone help?

Thanks in advance for your help ,

Phil
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
the Find function can be tricky. I've noticed it fail on seemingly exact contents. The reason was hidden characters, numbers formatted as text so they read exactly the same but Excel doesn't seem them the same.

Importing data from other workbooks is a common task and one I do at work everyday.

If you post your code and highlight any problematic lines it should be straight forward to fix.

Just ensure the value your using 'Find' for is an EXACT match between the 2
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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