Copy from two files
Thank you Dave. This is perfect. I can work with this.
Annie
"Dave Peterson" wrote:
Whoops. Same address.
Option Explicit
Sub testme()
Dim rngF As Range
Dim rngT As Range
Set rngF = Nothing
On Error Resume Next
Set rngF = Application.InputBox(Prompt:="Select the range", _
Default:=Selection.Areas(1).Address(external:=True ), _
Type:=8).Areas(1)
On Error GoTo 0
If rngF Is Nothing Then
MsgBox "Try later"
Exit Sub
End If
Set rngT = Nothing
On Error Resume Next
Set rngT = Application.InputBox(Prompt:="Select the range", Type:=8) _
.Cells(1)
On Error GoTo 0
If rngT Is Nothing Then
MsgBox "Try later"
Exit Sub
End If
rngF.Copy _
Destination:=rngT.Parent.Range(rngF.Cells(1).Addre ss)
Application.CutCopyMode = False
End Sub
The code still prompts for a "to range", but just uses that to get the correct
sheet.
Annie wrote:
Is is possible for a macro to copy a range of cells from one file to the same
range in another file? The two files would be open; but the file names may
change. The recorder records absolute ranges correctly, but hard codes the
file names. Thanks for any help.
Annie
--
Dave Peterson
|