VBA copying values from multiple sheets

epactheactor

New Member
Joined
Sep 9, 2015
Messages
38
Hello!

I'm studying VBA and actually trying to get a degree in programming so every chance I get to practice at work with code, I do so.

I've come up with something I want to do, but can't get my head around HOW to do it.

On Workbook 1 (called "Line" as an example), I would have 2 columns with one being Start and the other End (columns D & E). These would a path in feet for inspection.
Also on this sheet, there would be a section for the information on who and when they did the inspection on different parts of the line (A1:C4).

Example;

1ABCDE
2Inspector ID sectionNameDate
3AJoe5/1/2019
4GDana6/5/2016
5
6Inspected byTo (feet)From (feet)
7A07
8G750
9A5062
10A62100
11
12
13

<tbody>
</tbody>

Now to make this harder, the Inspector ID information (A1:C4) comes from a different workbook called "Inspector ID". It is presented like this;
Inspector InfoNameDate Inspected (newest - oldest)Inspected To (feet)Inspected From (feet)
AJoe5/1/201907
AJoe5/1/20195062
AJoe5/1/201962100
DDana6/5/2016750

<tbody>
</tbody>


I've created a code that puts the Inspector ID section (range A2:C4) information into workbook "Line" from workbook "Inspector ID." After it does, I've been manually filling out the "Inspected By" (C6:C10) section.

My question is, how would I go about filling out the "Inspected By" column in "Line"? It would have to reference the "Inspector ID" workbook to see the footages of who did which.

I would think I would need to create each Inspector info as an array/index, then compare the To and From.

Any help would be greatly appreciated.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
How about


Excel 2013/2016
ABCDE
1Inspector ID sectionNameDate
2AJoe05/01/2019
3GDana06/05/2016
4
5Inspected byTo (feet)From (feet)
6A07
7D750
8A5062
9A62100
Sheet1
Cell Formulas
RangeFormula
C6{=INDEX(Sheet2!$A$2:$A$5,MATCH(1,(Sheet2!$D$2:$D$5=D6)*(Sheet2!$E$2:$E$5=E6),0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi! Sorry for such a late reply. I wanted to thank you for trying. The Index formula was a great idea. The issue with it was that the values of location are not always perfect matched and more often than not there is overlap. I did manage somehow manage to go write the code that I need.

Thanks for your help.
 
Upvote 0
Glad you sorted it & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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