View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Transfer Value to another sheet with Macro

If you do want to do this, this will do it. It compensates for adding a
name, adds 7 days to the date, copies the values.

Sub copytolastcol()
With Sheets("yourdestinationsheetname")
Range("a2:a20").Copy .Range("a2")'copies names
lastcol = .Cells.SpecialCells(xlCellTypeLastCell).Column
..Cells(1, lastcol + 1) = .Cells(1, lastcol) + 7'adds date
For Each c In Range("a2:a" & Cells(Rows.Count, 1).End(xlUp).Row)
x = .Columns(1).Find(c).Row
..Cells(x, lastcol + 1).Value = Cells(c.Row, 2)
Next
End With
End Sub

--
Don Guillett
SalesAid Software

"EMoe" wrote in message
...

Hello,

I have a list of 10 names on sheet1 in column A. Column B had monetary
values besides the names.

Sheet2 has those same names in column A. Row 1 uptop has dates spaced
apart every 7 days.

I need a macro to find a name from sheet1, look on sheet 2 for the
matching name, then place its value in the next empty column. Hit the
button again, and it places the value in the next column. See Example
below:

Sheet 1 (this week):

A B
1 Mark $50
2 Paul $25
3 Sally $15

Next Week things has changed...

Sheet1 (next week):

A B
1 Mark $20
2 Paul $80
3 Sally $35


Sheet 2 (which is the DataBase):

A B C
1 Mark $50 $20
2 Paul $25 $80
3 Sally $15 $35

Note: I should be able to add more names if necessary to the sheet

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:

http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=375050