Finding a matching value in another file

A

andim

Hi

I have two .xls files, Learnmacs (lm) and Convoluted (cd) (some of you may
recognize these from earlier questions).

lm has 12 dates above which is a reference for these 12 dates. I have code
that finds the highest of these twelve dates and assigns that date to a
variable. Now all I want to do is open the second file - cd - search a range
of cells (A10:A20) for the reference, select the cell with the reference,
offset by 2 and paste the highest date. Here is the code I have so far (with
help from this Discussion group).

Private Sub CommandButton3_Click()

Dim ref As Range, gethighest As Range
Set ref = Worksheets("Sheet1").Range("A19")
Set gethighest = Worksheets("Sheet1").Range("A20:C23")
highest = Application.WorksheetFunction.Max(gethighest)
Workbooks.Open ("C:\Documents and Settings\Andrew\My Documents\Serious
Stuff\TCSpreadsheets\Convoluted.xls")
cd = ActiveWorkbook.Name
Dim cdrefcol As Range
Set cdrefcol = Range("A10:A20")

ref is the variable holding the reference to search for
highest is the variable holding the highest date
cdrefcol is the range to search in cd for the reference (ref)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top