ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy/pasting between 2 workbooks... (https://www.excelbanter.com/excel-programming/272490-re-copy-pasting-between-2-workbooks.html)

Joe Chavera

Copy/pasting between 2 workbooks...
 
Hi there,
Thank you very much for the very quick reply.
I probably should have let you know that I also had the worksheets
named.

Down below your example is my feeble attempt using the VBA recorder to
show you what I was trying to accomplish.
My code works fine until I save the two workbooks out to differently
named workbooks.

Again, thanks for your input.
Joe.


Dim sFile As String

sFile = Format(Date, "dddmmddyy")
Workbooks("Tracking-" &
sFile).Worksheets(1).Range("A1:A100").CopyWorkbook s("CallResults-" &
sFile).Worksheets(1).Range("a1:a100").PasteSpecial Paste:=xlValues


' Original Problem.
' The code below works fine............until..........I copy the
workbooks to a new name.
' Example:
' SourceFile.xls is saved out to SourceFileCopiedOnce.xls
' and
' DestinationFile.xls is saved out to
DestinationFileCopiedOnce.xls.
' I understand that I've hardcoded the original workbook names in the
code below and that those references
' don't update respectively when doing a "Save As" to a different named
workbook.




' Range("A1").Select
' ActiveCell.FormulaR1C1 = "Start here"
' Range("B4:B13").Select
' Selection.Copy
' Windows("DestinationFile.xls").Activate
' Range("B4").Select
' Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
' False, Transpose:=False
' Range("A1").Select
' Windows("SourceFile.xls").Activate
' Range("A2").Select
' Application.CutCopyMode = False
' ActiveCell.FormulaR1C1 = "Stop here"
' Range("A3").Select
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 02:29 PM.

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