View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob C Bob C is offline
external usenet poster
 
Posts: 23
Default Copy cell value from W/book2 into W/book1

Mike
This is the code with correct W/book & sheet names inserted.
It is copying Cell A5 on the same sheet into C19.

Sub Test()

Dim wb1 As Workbook, wb2 As Workbook
Dim x As Integer
Dim findrng As Range

Set wb1 = Workbooks("Transactions.xls")
Set wb2 = Workbooks("Statements.xls")
Set findrng = wb2.Worksheets("Data").Range("E1:E65536")
x = WorksheetFunction.Match("Salary", findrng, 0)

wb1.Worksheets("Summary").Range("C19").Value = _
Range(findrng.Item(x).Address).Offset(0, -4).Value

End Sub
--
Thank you

Bob C
It cost''''''''s little to carry knowledge with you.


"Mike Fogleman" wrote:

Sub Test()
Dim wb1 As Workbook, wb2 As Workbook
Dim x As Integer
Dim findrng As Range

Set wb1 = Workbooks("Book1")
Set wb2 = Workbooks("Book2")
Set findrng = wb2.Range("E1:E65536")
x = WorksheetFunction.Match("Sale", findrng, 0)
wb1.Worksheets("Sheet8").Range("C19").Value =
Range(findrng.Item(x).Address).Offset(, -4).Value
End Sub

Mike F
"Bob C" wrote in message
...
Hi

Using Office 2003

I'm trying to find in W/book2, Sheet1 Column E the first row containing
the
word Sale.
Then in Column A same row, copy cells date value and paste value into
W/book1 Sheet8 cell C19.

TIA
--
Thank you

Bob C
It cost''s little to carry knowledge with you.