Workbook.Range Problem
I have a workbook that when I click a button it runs a macro that
allows me to open up another workbook of my choice, then copy a
certain range in the newly opened workbook and paste it into my
workbook that ran the macro. My question is, How can I set a range in
my newly opened workbook as a variable. It works when I do it like
this.
______________________________________________
Windows("MyNewlyOpenedWorkbook").Activate
Range("A1:A5").Select
Selection.Copy
Windows("MyWorkbookWithMacro").Activate
Range("A1:A5").Select
Selection.Paste
______________________________________________
What I would like to be able to do is something like this:
Dim rCopyRange As Range
Dim rPasteRange As Range
Set rCopyRange = MyNewlyOpenedWorkbook.Range("A1:A5")
Set rPasteRange = Range("A1:A5")
Windows(sOpenJobFileName).Activate
rCopyRange.Select
Selection.Copy
Windows("BIDPROG9.xls").Activate
rPasteRange.Select
Selection.Paste
_____________________________________________
So again I ask. How can I name a range on my newly opened workbook?
Any input would relieve this building headache I'm working on.
Thanks
|