Macro: Copy & paste array of cells into specific location on different worksheet

jb2_86_uk

New Member
Joined
Feb 9, 2012
Messages
31
Hi All,

Looking for a bit of guidance re: the above.

I have inherited rather ungainly couple of data tables (let's call them 'Original' & 'Revised') and am working on an easier way for changes to be made or modeled On a separate worksheet ('Changes') I have done all the leg-work in terms of modifying the 'Original' data, the final step is to copy the output (an array of cells 1 row x 78 columns) into the appropriate location on the 'Revised' data table.

I would like to do this with a macro, attached to an 'Update' button for example, so changes and tweaks can be made before any data is overwritten.

I tried to record a macro to copy the row ID from the 'Changes' worksheet, then move to the 'Revised' sheet and use the Find function to identify the correct row, then used the Right key to navigate to the correct column (K). Now I have the correct destination cell highlighted, back to 'Changes' and copied the data array. Finally, switch back to 'Revised' and Paste Values. Does that make sense?

Unfortunately when I look at the macro in VBA, the Find operation has recorded the absolute value of the first copied cell when I recorded the macro, rather than picking up any value that particular cell may contain. Furthermore, my attempts to select the relevant column appear to have hard-coded a cell reference into the macro.

So as it stands, my macro will work... except it is always going to paste the data onto one particular row in my Data Table! How can I amend this so it will use the correct row ID and paste the data into the relevant cell reference?

A couple of things to note:
The array will always be pasted into column K, however the row could be anything between 2 and 150.
The array will always be the same size and copied from a set location on the 'Changes' worksheet
The array must be pasted as values.

Apologies if I have not made sense here, any advice would be appreciated!

Thank you,
JB
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Paste the recorded code (be sure to use code tags to preserve indents) and add notes where you need something changed.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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