Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 208
Default Moving data from one spreadsheet to another

I have 2 spreadsheets: SheetA and SheetB. SheetA is a list of names. SheetB
is a list of names with specific data about each name. So SheetB Column A
has names, Column B has the age, Column C has the address, Column D has total
sales for the month, and Column E has hair color. I need to write a macro
that will take the first name in SheetA, find that same name in SheetB, copy
the info in Columns B, D, E, and paste that info in Columns B,C,D in SheetA
beside the name, move to the next name in SheetA and repeat the process. How
can I do this?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Moving data from one spreadsheet to another

You don't need a macro.

You just need to use the VLOOKUP function.

In SheetA B1 enter =VLOOKUP(A1,Sheet2!$A$1:$E$100,COLUMN(),FALSE)

Copy across to E1

Select B1:E1 and copy down.

If you do not get an exact match you will get #N/A

To avoid that add the ISNA function like so.

=IF(ISNA(vlookup formula),"",(vlookup formula)

Adjust $E$100 to your range.


Gord Dibben MS Excel MVP

On Mon, 23 Mar 2009 14:34:01 -0700, Bishop
wrote:

I have 2 spreadsheets: SheetA and SheetB. SheetA is a list of names. SheetB
is a list of names with specific data about each name. So SheetB Column A
has names, Column B has the age, Column C has the address, Column D has total
sales for the month, and Column E has hair color. I need to write a macro
that will take the first name in SheetA, find that same name in SheetB, copy
the info in Columns B, D, E, and paste that info in Columns B,C,D in SheetA
beside the name, move to the next name in SheetA and repeat the process. How
can I do this?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Moving data from one spreadsheet to another

Hi,

You do not need a macro for this. Please read up on the VLOOKUP() function
in the Helo menu

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Bishop" wrote in message
...
I have 2 spreadsheets: SheetA and SheetB. SheetA is a list of names.
SheetB
is a list of names with specific data about each name. So SheetB Column A
has names, Column B has the age, Column C has the address, Column D has
total
sales for the month, and Column E has hair color. I need to write a macro
that will take the first name in SheetA, find that same name in SheetB,
copy
the info in Columns B, D, E, and paste that info in Columns B,C,D in
SheetA
beside the name, move to the next name in SheetA and repeat the process.
How
can I do this?


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 208
Default Moving data from one spreadsheet to another

The reason I want a macro is I need to assign it to a button. SheetA and
SheetB changes every week. If I have a macro button I can just run the macro
once I have all the names in SheetA.

"Gord Dibben" wrote:

You don't need a macro.

You just need to use the VLOOKUP function.

In SheetA B1 enter =VLOOKUP(A1,Sheet2!$A$1:$E$100,COLUMN(),FALSE)

Copy across to E1

Select B1:E1 and copy down.

If you do not get an exact match you will get #N/A

To avoid that add the ISNA function like so.

=IF(ISNA(vlookup formula),"",(vlookup formula)

Adjust $E$100 to your range.


Gord Dibben MS Excel MVP

On Mon, 23 Mar 2009 14:34:01 -0700, Bishop
wrote:

I have 2 spreadsheets: SheetA and SheetB. SheetA is a list of names. SheetB
is a list of names with specific data about each name. So SheetB Column A
has names, Column B has the age, Column C has the address, Column D has total
sales for the month, and Column E has hair color. I need to write a macro
that will take the first name in SheetA, find that same name in SheetB, copy
the info in Columns B, D, E, and paste that info in Columns B,C,D in SheetA
beside the name, move to the next name in SheetA and repeat the process. How
can I do this?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Moving data from one spreadsheet to another

Sub Auto_Fill()
Dim Lrow As Long
Sheets("Sheet1").Select
Range("B1:E1").Formula = _
"=IF(ISNA(VLOOKUP($A1,Sheet2!$A$1:$E$100,COLUMN(), FALSE)),""""," & _
"VLOOKUP($A1,Sheet2!$A$1:$E$100,COLUMN(),FALSE ))"
Lrow = Range("A" & Rows.Count).End(xlUp).Row
Range("B1:E" & Lrow).FillDown
End Sub

Please note I made a mistake in the formula posted yesterday.

I left out the absolute reference for column A as the lookup value.

Corrected in the above version to $A1



Gord


On Tue, 24 Mar 2009 06:25:02 -0700, Bishop
wrote:

The reason I want a macro is I need to assign it to a button. SheetA and
SheetB changes every week. If I have a macro button I can just run the macro
once I have all the names in SheetA.

"Gord Dibben" wrote:

You don't need a macro.

You just need to use the VLOOKUP function.

In SheetA B1 enter =VLOOKUP(A1,Sheet2!$A$1:$E$100,COLUMN(),FALSE)

Copy across to E1

Select B1:E1 and copy down.

If you do not get an exact match you will get #N/A

To avoid that add the ISNA function like so.

=IF(ISNA(vlookup formula),"",(vlookup formula)

Adjust $E$100 to your range.


Gord Dibben MS Excel MVP

On Mon, 23 Mar 2009 14:34:01 -0700, Bishop
wrote:

I have 2 spreadsheets: SheetA and SheetB. SheetA is a list of names. SheetB
is a list of names with specific data about each name. So SheetB Column A
has names, Column B has the age, Column C has the address, Column D has total
sales for the month, and Column E has hair color. I need to write a macro
that will take the first name in SheetA, find that same name in SheetB, copy
the info in Columns B, D, E, and paste that info in Columns B,C,D in SheetA
beside the name, move to the next name in SheetA and repeat the process. How
can I do this?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
moving on a spreadsheet with arrows Don Excel Discussion (Misc queries) 6 February 1st 08 08:52 PM
Matching and Moving Data From One Spreadsheet to Another? [email protected] Excel Discussion (Misc queries) 1 March 18th 06 02:21 PM
Matching and Moving Data From One Spreadsheet to Another? [email protected] Excel Discussion (Misc queries) 1 March 18th 06 01:18 PM
Moving Around a Blank Spreadsheet carl Excel Worksheet Functions 1 September 15th 05 06:54 PM


All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"