Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy data from one file to another


Does this solve your problem?

PatchFname = Application.GetOpenFilename("Excel files (*.xls), *.xls")
If PatchFname < "" Then
Workbooks.Open PatchFname
PatchFname = ActiveWorkbook.Name
End If
TimT Wrote:
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!



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=542129

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Copy data from one file to another

That did it!

"Ikaabod" wrote:


Does this solve your problem?

PatchFname = Application.GetOpenFilename("Excel files (*.xls), *.xls")
If PatchFname < "" Then
Workbooks.Open PatchFname
PatchFname = ActiveWorkbook.Name
End If
TimT Wrote:
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!



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=542129


Reply
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
copy data for match word from one file to another file mishak Excel Worksheet Functions 1 December 2nd 09 02:11 AM
Copy data without opening file new_to_vba[_20_] Excel Programming 1 March 2nd 06 01:16 AM
copy data when enter the file name new_to_vba[_7_] Excel Programming 0 February 7th 06 07:32 AM
How do I copy data from a cell in one file to another? acraig New Users to Excel 1 February 15th 05 03:09 PM
Code to copy data from 1 file to another The Gza Excel Programming 1 February 28th 04 06:29 AM


All times are GMT +1. The time now is 02:24 PM.

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"