The problem is that unless told otherwise, the macros "assume" the
workbook you refer to is the one the macros RESIDE in.
Basically, it uses two objects:
ThisWorkBook and ActiveWorkBook
ThisWorkBook is the workbook that has the macros.
ActiveWorkBook is the workbook currently selected.

Another object is ActiveSheet.
This is the Sheet of the ActiveWorkBook that is selected.

You're probably using Selection.Paste.
Which means to take the items that are in the Clipboard
and paste in the cell currently selected.
But the ASSUMPTION is that it is in the workbook where the macro is
running!

To get past this, TELL excel which workbook you mean.

you can use:

ActiveSheet.Paste

or even
Activeworkbook.Activesheet.Paste

Hope this helps,

paul



----- Original Message ----
> From: FamilyGuy902 <[EMAIL PROTECTED]>
> To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
> Sent: Monday, December 8, 2008 10:42:58 AM
> Subject: $$Excel-Macros$$ Simple Copy/Paste Macro won't work.
> 
> 
> Hello.  "Macros.xls" is where I store all of my macros.  I get another
> file daily which contains the data that I would like to run the macos
> on. I have written a simple macro that copies data from my daily file
> and pastes into the same file in the same sheet.  The problem I am
> having is that when it gets to the paste command, it is pasting it in
> the Macros.xls file, instead of in the daily file.  Is there any way
> to force it to paste within the daily file?  The name of the daily
> file changes daily, so I'd rather not hard-code the daily file name
> into my macro.  Any suggested code or tips would be helpful!
> 
> 

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to