Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2012, 03:04 PM
Registered User
 
Join Date: Aug 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow Copy row data from one file to another based on matching column data

Hi,

This one is very difficult for me.

I have 2 files named confirm.xls and export.csv both files have identical data in columnA (starting at A2) but not in the same order and using columnA to match, I need the data from confirms.xls on that same row on columns C,E and F to be written over to the other file export.csv in the the same columns but in the row that they match on columnA.

Example confirm.xls
ColumnA | ColumnC | ColumnE | ColumnF
114919118-1 | FEDX | MP-001 | 1
114911422 | FEDX | MOP305 | 2
114901552 | FEDX | PB05 | 1

Example required output file export.csv
ColumnA | ColumnC | ColumnE | ColumnF
114901552 | FEDX | PB05 | 1
114919118-1 | FEDX | MP-001 | 1
114911422 | FEDX | MOP305 | 2

I have been trying IF(INDEX(confirm.xls!$A$2:$A,MATCH(export.csv!$A$2 :$A)) THEN
and I'm not sure how I would copy that row column C,E and F to to export.csv on the same row as it matched.
I have tried using functions with no success.

I appreciate any help,

David
 
Old August 19th, 2012, 10:55 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi David

Have you tried using VLOOKUP function. This might be helpful for your case

Also if you want to do using VBA, try using the Find Method and then copy the entire Range (C to F) for each row where the Find is successful

I hope the values in Column A will be unique

The following link can be of some help to start with

http://vbadud.blogspot.in/2007/05/dy...xcel-data.html

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT for converting column based xml to row based one sayusekhar XSLT 4 March 8th, 2011 08:20 AM
Data too long for column 'ResumeInfo' at row 1 Snowby Pro PHP 0 April 2nd, 2008 02:32 AM
No data exists for row/column sirmilt BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 March 21st, 2008 11:03 AM
extra column based on data in gridviewrow edwin.debrouwere ASP.NET 1.0 and 1.1 Basics 1 October 13th, 2006 09:18 AM
extra column based on data in gridviewrow edwin.debrouwere ASP.NET 1.0 and 1.1 Professional 0 October 13th, 2006 09:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.