There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Business Applications
Tag Cloud
audio backup blue screen boot bsod compaq computer cpu crash dell drivers dvd error excel firefox format freeze freezing hard drive install internet internet explorer kb951748 laptop loss of internet malware memory motherboard network networking outlook outlook 2007 problem restart screen slow sound spyware startup trojan update virus vista website windows windows xp winxp wireless zonealarm zone alarm
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Need Help Writing a Macro for Excel to Move Data From One Spreadsheet to Anot


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
macgirl27's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Jul 2008
Location: Destin, FL
Experience: Advanced
22-Jul-2008, 06:17 PM #1
Cool Solved: Need Help Writing a Macro for Excel to Move Data From One Spreadsheet to Anot
I need to write a macro that will copy data from one spreadsheet into a separate spreadsheet (not in the same file). Here is the scenario...

On the first spreadsheet I have a customer's name in one column and a customer's address in another column. On a separate spreadsheet a have those same customer's names without the addresses. On the second spreadsheet the customer's name may be listed more than once. What I need to do is add the corresponding address to the second spreadsheet beside the name of the customer (identical data from both spreadsheets). The reason copy and paste won't work is because the customer may appear numerous times on the second spreadsheet and their are approximately 50,000 rows of data.

The macro needs to basically say IF Spreadsheet 1, Column A (customer) equals Spreadsheet 2, Column G (customer) then ADD/REPLACE info from Spreadsheet 1, Column B (address) to Spreadsheet 2, Column H (currently blank). I just can't figure out how to make it do that. ANY HELP ANYONE CAN GIVE IS APPRECIATED!
Squashman's Avatar
Distinguished Member with 12,733 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
22-Jul-2008, 08:10 PM #2
Might want to ask the moderators to move this thread to the Business Applications section. That is where they deal with most of these types of questions.
slurpee55's Avatar
Computer Specs
Distinguished Member with 4,517 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
23-Jul-2008, 03:11 PM #3
You don't really need a macro. If you have your list of names and addresses in a book called Book2 on Sheet1 in columns A and B and the list of names only in column A of Sheet1 in Book1, enter this formula in cell B1 on Sheet1 of Book1 (next to the names):
=VLOOKUP(A1,[Book2.xls]Sheet1!$A:$B,2,0)
This tells excel to look in Book2, Sheet1 for the values.
If you do not have Book2 open when you open Book1 you will get a warning that the formula is trying to update from an outside source - click okay. This will actually alter the formula by inserting the full address for the Excel book it is linked to - in this case, Book2.
Thus, it changed my formula to
=VLOOKUP(A1,'C:\Documents and Settings\username\Desktop\[Book2.xls]Sheet1'!$A:$B,2,0)

If you prefer, you can Copy all of the addresses found in this way then Paste Special, Values back in - that will replace the formula with the actual addresses.
__________________
Iowa? I could have sworn this was heaven.
Well, I think I can answer this question most successfully in mime.

My theme song...
macgirl27's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Jul 2008
Location: Destin, FL
Experience: Advanced
23-Jul-2008, 03:25 PM #4
Thank you so much! I've been beating my head against the wall writing every "IF" formula I could think of and I couldn't make it work. Your solution worked like a charm.
slurpee55's Avatar
Computer Specs
Distinguished Member with 4,517 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
23-Jul-2008, 03:51 PM #5
Glad to help - welcome to the forum!!!
slurpee55's Avatar
Computer Specs
Distinguished Member with 4,517 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
23-Jul-2008, 03:57 PM #6
There's probably some way to do it with an Index, Match, but it isn't coming to me.
Closed Thread

Tags
excel, macro

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 05:27 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.