Copy data from one file to another
hello all,
I'm trying to prompt a user to open a workbook (and dim that filename) so
data from multiple tabs can be copied to corresponding tabs in the current
open workbook. The code would need to go back and forth between the workbooks
to copy and paste multiple areas.
I get a subscript out of range when I run this code from a module.
Here is some of the code I have so far:
Public Function RunPatch()
Dim PatchFname As String
PatchFname = Application.GetOpenFilename("Excel files (*.xls), *.xls")
If PatchFname < "" Then
Workbooks.Open PatchFname
End If
'Wages
Sheets("Wages").Select
Range("A11:BG17").Select
Selection.Copy
Windows("1040 Workpapers V2.1.xls").Activate
Sheets("Wages").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
'Dividends
Windows(PatchFname).Activate
Sheets("Interest & Dividends").Select
Range("A17:C36").Select
Selection.Copy
Windows("1040 Workpapers V2.1.xls").Activate
Range("A17").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Please!! Thanks!
|