Find a day and copy

C

Carlitos

Hi everyone , Could you please help with this code :

1) copy from "Source.xls" the "C2" range.... Is a date "22/06/04"
1) in "target.xls" the column "A" have 31 rows(days)= 1 Month
3) if the DAY in "source.xls" is the same in "target.xls", column "A",
then paste from "Source.xls" the Range("G1:G10")in target.xls into a
single line, and then find another day....

The purpose is to keep a log of the sales, amounts and the date onto
this "target" workbook. My difficulty is coming up with the code to
find the same day and then paste.


Thanks a lot...
 
B

Bernie Deitrick

Carlitos,

You don't say what the worksheet names involved are: I will assume
"SourceSheet1" for the Source.xls, and "TargetSheet1" for the Target.xls:

Sub Carlitos()
Dim myRow As Long
Dim myDate As Date
Workbooks("Source.xls").Worksheets("SourceSheet1") _
.Range("G1:G10").Copy
Workbooks("Target.xls").Activate
Worksheets("TargetSheet1").Select
myDate = Workbooks("Source.xls"). _
Worksheets("SourceSheet1").Range("C2").Value
myRow = Range("A1:A32").Find(myDate).Row
Range("B" & myRow).Select
Selection.PasteSpecial Transpose:=True
End Sub

HTH,
Bernie
MS Excel MVP
 

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