LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copying cells from one workbook to another

I have a very redundant project where I need to copy a range of cells from
one workbook and paste them in another thousands of times. The thing is,
there are hundreds of source workbooks and only one destination workbook.
But, all the source workbooks are formatted the same. So, I recorded a macro
to go back and forth and copy and paste the ranges of cells. The problem is
that there are absolute references in my code and I need there to be relative
references. I have no problem doing this for the cells, but I cannot figure
out how to do it for the workbook. Here is an example of the code:

Windows("PTL40125.T2B").Activate
ActiveWindow.SmallScroll Down:=9
Range("C82:C86").Select
Application.CutCopyMode = False
Selection.Copy
Windows("PTL 2000 JAN_19 LINES.xls").Activate
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=18
Range("G11002").Select

My problem is I want it to use whatever file I open and make that the active
workbook (or window) and be able to reference that rather than the absolute
reference Windows("PTL40125.T2B").Activate as that only works for that one
file.

I have another macro that pops a file open box up where you select the file
and it is assigned a variable name, and I tried to use this variable, but it
doesn't work because it's referencing the entire path of the file, rather
than just the workbook name.

I hope this makes sense to someone and they can help. Thanks!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying cells from one workbook to another Quinci Excel Worksheet Functions 0 January 25th 08 05:57 PM
Automatically copying cells to another workbook Just Askin Setting up and Configuration of Excel 1 July 13th 07 08:06 AM
Copying cells from one workbook to another. ndm berry[_2_] Excel Programming 2 October 10th 05 08:39 AM
Problem copying cells to another workbook Sergio Calleja Excel Programming 2 January 21st 05 09:45 AM
Need Help Copying cells into another workbook Andrew[_47_] Excel Programming 1 September 17th 04 12:47 PM


All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"