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!
Bookmarks