Help Writing a Macro

cal.bears

New Member
Joined
Sep 15, 2006
Messages
2
Hi,

i'm new to these forums and was wondering if anyone could help me write a macro for work. I have a workbook with two sheets. Each Sheet has a Folio Number in column A. I need to import data from sheet 2 (Columns B-H) into sheet 1 (Columns E-K) based on the Folio ID Number in Column A.

So basically in sheet 1 I need a program that looks up each rows folio Number, then looks up that number in Sheet 2, copies the relevant data in Sheet 2, then goes back to sheet 1 and pastes the data.

There are around 8,000 rows I need to populate in Sheet 1 through this method. I'm hoping there exists some way to program this into Excel via Macro/formulas.

-Alex
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Alex

Do you really need code?

Couldn't you just use VLOOKUP?

For example in column E on sheet1,

=VLOOKUP(A1, Sheet2!$A$1:$B$8000, 2, 0)

In column F,

=VLOOKUP(A1, Sheet2!$A$1:$B$8000, 3, 0)

etc
 
Upvote 0
Alex

Do you really need code?

Couldn't you just use VLOOKUP?

For example in column E on sheet1,

=VLOOKUP(A1, Sheet2!$A$1:$B$8000, 2, 0)

In column F,

=VLOOKUP(A1, Sheet2!$A$1:$B$8000, 3, 0)

etc

A variation of that formula works for Column E on sheet 1
=VLOOKUP(A2, Sheet2!$A$2:$B$8000, 2, 0). It returns the values I need.

For Column F it starts returning N/A values. I need it to always reference the Folio Number which is in Column A when it pulls up data.

So for Column F2. It should look to Column A2. Then go to Sheet 2. Find the same number in Column A and then copy the contents of that rows column.

Sheet 2 Columns B-H need to copy over to Sheet 1 Columns E-K.
 
Upvote 0
Well all you need to do is anchor the column for the VLOOKUP value.

=VLOOKUP($A2, Sheet2!$A$2:$B$8000, 2, 0)
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

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