Macro to CopyPaste from one excel to another using a reference number in a column

Rakesh99932

New Member
Joined
Feb 25, 2020
Messages
24
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2011
  5. 2010
Platform
  1. Windows
Hi,
I have 2 excel sheets. Requirement & Destination (Both placed below). Need to copy and paste few data from Requirement to Destination.

Requirement:
1. Copy values in column F (yellow highlighted) of the 1st Department from Requirement Excel and paste in Column E (Yellow highlighted) of the 1st Department in the Destination Excel.
2. Need the above steps to be done for all the Departments in the file, although I had mentioned only 2 departments, there will be multiple in real.
3. But in some cases, in the destination excel, there might be extra rows highlighted in RED, which we can ignore, and paste the values from row number 18 as shown below.

Kindly help me to achieve this and please let me know if you need further clarifications.

Requirement.xlsx
ABCDEFGH
1DEPARTMENTCLIENT TYPESQUESTIONNAIRE
2Main DeptDEPT ID .1DEPT NAMEIID PRC .1OLD - QUEST IDNEW - QUESTI IDBEFORE APPTRULE
3Last, First53015786.53015878653020543.530204545530307876
4
5Main Dept 11st DepartmentHamilton Ham61815550202070072100015500
61046115550202070072100015500
7576115551202070172100015501
81046115551202070172100015501
961615307202071072100015502
10576115307202071072100015502
111046015307202071072100015502
1261815552202070272100015503
131046115552202070272100015503
14576115552202070272100015503
152nd DepartmentSI BUL PAL61815550202070472100015505
161046115550202070572100015506
17576115551202070572100015506
181046115551202070572100015506
1961615307202070672100015507
20576115307202070672100015507
211046015307202070672100015507
2261815552202070772100015508
231046115552202070772100015508
24576115552202070772100015508
Requirement



Destination.xlsx
ABCDEFGHI
1.1.253015786.53015878653020543.530204545530307876530354789.5303575433
2
3categorycategorycategorycategorycategorycategorycategorycategorycategory
4a bcdefgh
5Dept IdDEPT NAMEVISIT TYPEVISIT TYPE NAMEVISIT TYPE IDVISIT TYPE Des# DAYS BEFORE APPTQUESTIONNAIREAPPT
61st DepartmentHamilton Hamil Ha618Name15550Fes72100015500South Health
710461Name15550Fes72100015500South Health
85761Name15551Fes72100015501South Health
910461Name15551Fes72100015501South Health
10616Name15307Fes72100015502South Health
115761Name15307Fes72100015502South Health
1210460Name15307Fes72100015502South Health
13618Name15552Fes72100015503South Health
1410461Name15552Fes72100015503South Health
155761Name15552Fes72100015503South Health
162nd DepartmentSI BUL Palminton999Name15552Fes72100015503South Health
17888Name15553Fes72100015504South Health
18618Name15550Fes72100015500South Health
1910461Name15550Fes72100015500South Health
205761Name15551Fes72100015501South Health
2110461Name15551Fes72100015501South Health
22616Name15307Fes72100015502South Health
235761Name15307Fes72100015502South Health
2410460Name15307Fes72100015502South Health
25618Name15552Fes72100015503South Health
2610461Name15552Fes72100015503South Health
275761Name15552Fes72100015503South Health
Destination
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Is your Destination file being set up beforehand with same number of row as the Requirement file (i.e. are the two file are having fix number of row?
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

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