Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Select, find in another book, copy, return and paste | Excel Discussion (Misc queries) | |||
how to copy a cell in excell and paste in a txt file with macro | Excel Discussion (Misc queries) | |||
Not using select for copy and paste | Excel Discussion (Misc queries) | |||
On a DDE Linked worksheet : Copy and Paste Value to a to a file via a macro ? | Links and Linking in Excel | |||
Select All and copy and paste | Excel Programming |