vba to copy selected cells and some cells adjacent to next blank row in different workbook

bh24524

Active Member
Joined
Dec 11, 2008
Messages
369
Office Version
  1. 365
  2. 2007
Hello, as the title says, I'd like to have a macro that will copy whatever cell I have selected as well as several cells in the same row and paste those into a different workbook. The first workbook, called MW714 Template, is one that report data from a downloaded report is pasted. From there a simple recorded macro extracts some numbers from one column and removes dashes in another. That workbook looks like this:
1736252806971.png


The second workbook, called OSD Template where data is copy/pasted from the MW714 Template looks like this:

1736255188298.png


Data from the MW714 Template is pasted as values into rows 16 thru 25 of the OSD Template. So in the MW714 Template, we would copy data from the following columns: K, M, and S. Those would then be pasted into the OSD Template in columns K, M, and either N or P(If S has a positive qty from the MW714 Template, it would be pasted in column N and if it has a negative qty, it would go in column P).

So to give a specific example using the sample data above in the first screenshot, let's say after some research that I want to have data copied from row 18 of the MW714 Template(Not all rows will be copied - research must be done to determine which ones will). That info is Item#: 3262984 Descript: EASTER CHOC MIXED and -2 in the Over/Short column. If I had cell K18 selected and hit a button to run this macro, I would expect to see that info populate in the OSD Template below:

1736256495050.png


If I go back then to the MW714 report to research my next item, let's say I determine row 19 needs copied. If I select that cell K19 and click my macro button, I'd expect to then see it populate below the entry I just did:

1736256719554.png


So basically if rows already contain data in the OSD Template, it would just paste new data to the next available row.

I hope this information is clear. Please let me know if I can clarify anything.
 

Attachments

  • 1736252671608.png
    1736252671608.png
    50.6 KB · Views: 2
  • 1736254477501.png
    1736254477501.png
    41.1 KB · Views: 2

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Something I wanted to add, if whatever item# from the MW714 template is copied if the code could then color that row with yellow highlight.
 
Upvote 0
solution found here
Good to hear you got a solution. Not all readers here will be able to access the linked solution so if you would like to post the actual solution here then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0

Forum statistics

Threads
1,225,358
Messages
6,184,501
Members
453,236
Latest member
Siams

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