Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Two workbooks


Hi:

I have two workbooks 1.xls and 2.xls. Both workbooks have in column A
a list of "jobs" but not in the same order, such as:

1.xls

job 444
job 888
job 222
job 555


2.xls

job 222
job 555
job 888
job 444


What I need is to compare 1.'xls to 2.xls and if it finds the job i
2.xls then copy a cell from 2.xls but 2 columns down from the job to
cell in the same row as job in 1.xls but 9 columns down.

Any help would be appreciated

--
halem
-----------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...nfo&userid=993
View this thread: http://www.excelforum.com/showthread.php?threadid=27221

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Two workbooks

First, does 2 columns down mean 2 columns to the right?
And 9 columns down means 9 columns to the right???

If yes, then how about this:

Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng1 As Range
Dim myRng2 As Range
Dim res As Variant

With Workbooks("book1.xls").Worksheets("sheet1")
Set myRng1 = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

With Workbooks("book2.xls").Worksheets("sheet2")
Set myRng2 = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng1.Cells
res = Application.Match(myCell.Value, myRng2, 0)
If IsError(res) Then
'not found
Else
myCell.Offset(0, 9).Value _
= myRng2(res).Offset(0, 2)
End If
Next myCell

End Sub

Adjust the workbook names and worksheet names to match your situation.


halem2 wrote:

Hi:

I have two workbooks 1.xls and 2.xls. Both workbooks have in column A,
a list of "jobs" but not in the same order, such as:

1.xls

job 444
job 888
job 222
job 555

2.xls

job 222
job 555
job 888
job 444

What I need is to compare 1.'xls to 2.xls and if it finds the job in
2.xls then copy a cell from 2.xls but 2 columns down from the job to a
cell in the same row as job in 1.xls but 9 columns down.

Any help would be appreciated.

--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=272215


--

Dave Peterson

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
Updating Workbooks from multiple links Workbooks TimJames Excel Worksheet Functions 1 December 15th 07 03:34 PM
Copy/ move selected data from workbooks to seperate worksheets or workbooks Positive Excel Worksheet Functions 1 August 30th 07 04:54 PM
Display 2 formulas from source workbooks to destination workbooks Excel_seek_help Excel Discussion (Misc queries) 4 April 27th 06 08:13 PM
suddenly my excel workbooks are "shared workbooks" Maggie's mom Excel Discussion (Misc queries) 1 August 28th 05 09:20 PM
Workbooks.Open closes other workbooks S. Daum Excel Programming 1 August 21st 03 07:47 PM


All times are GMT +1. The time now is 08:46 AM.

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

About Us

"It's about Microsoft Excel"