Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select File Copy/Paste Macro Help....

I'm trying to setup a macro that allows the user to select a file and it
will then copy/paste from that file to Thisworkbook. The following
gives me an error:

Sub Macro1()
Dim wbkData As Workbook, wsData As Worksheet
Dim fn As Variant

fn = Application.GetOpenFilename("Excel-files,*.xls", _
1, "Select File To Open", , False)
If TypeName(fn) = "Boolean" Then Exit Sub
' the user didn't select a file
Debug.Print "Selected file: " & fn
Workbooks.Open fn

Set wsData = wbkData.Sheets("Sheet1")

Application.ScreenUpdating = False
With ThisWorkbook.Sheets("Sheet1")
wsData.Range("a1:a5").Copy Destination:=.Range("a1")
wsData.Range("b1:b5").Copy Destination:=.Range("b1")
wsData.Range("c1:c5").Copy Destination:=.Range("c1")
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
'do the copying

End Sub

I would also like to add a line which will run the copy/paste on ALL
sheets that have the same tab name.

Any ideas would be greatly appreciated,
Jay
_________________


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select File Copy/Paste Macro Help....

The GetOpenFile method part of the macro works fine, however when I try
to use that newly opened file, I get a runtime error 91...

Any ideas....:(

Jay


---
Message posted from http://www.ExcelForum.com/

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
Select, find in another book, copy, return and paste Watson[_2_] Excel Discussion (Misc queries) 0 August 15th 08 07:14 PM
how to copy a cell in excell and paste in a txt file with macro Krishna_AJ Excel Discussion (Misc queries) 0 June 21st 07 09:51 PM
Not using select for copy and paste damorrison Excel Discussion (Misc queries) 2 April 8th 07 08:41 PM
On a DDE Linked worksheet : Copy and Paste Value to a to a file via a macro ? Martin Links and Linking in Excel 0 November 20th 06 11:19 AM
Select All and copy and paste Ashok[_2_] Excel Programming 7 November 11th 03 03:46 AM


All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"