ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find a day and copy (https://www.excelbanter.com/excel-programming/302197-find-day-copy.html)

Carlitos

Find a day and copy
 
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...

Bernie Deitrick

Find a day and copy
 
Carlitos,

You don't say what the worksheet names involved a 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

"Carlitos" wrote in message
om...
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...





All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com