![]() |
Import a spreadsheet
can anyone help me with importing one spreadsheet into another. the sheet
to be imported has about 200 rows and about 10 columns. i basically want to attempt to use the GetOpenFilename method to select the file, and copy and paste the text into the active sheet. TIA. |
Import a spreadsheet
Hi, give this a try:
'############################################ Dim Fname$, ParentBook$ ParentBook = ActiveBook.Name MsgBox "Select file." On Error GoTo 0 FName = Application.GetOpenFilename If FName = "False" Then MsgBox "You failed to File. This will end the process.", vbOKOnly Exit Sub End If Err.Clear Range("A1:C19").Select 'Whatever range you want Selection.Copy Application.DisplayAlerts = False ActiveWorkbook.Close SaveChanges:=False Application.DisplayAlerts = True Cells(1,1).Select ActiveSheet.Paste '################################### HTH--Lonnie M. |
Import a spreadsheet
Hi, you may also want to take a look at the Copy Before function, it
looks something like this: Sheets("myOriginalWorksheet").Copy Befo=Workbooks("myGetOpenWorkbook").Sheets(1) Regards--Lonnie M. |
Import a spreadsheet
Let me make a correction to my above example, I changed my thought
process in mid stream: '############################################ Dim Fname$, ParentBook$, CildBook$ ParentBook = ActiveBook.Name MsgBox "Select file." On Error GoTo 0 FName = Application.GetOpenFilename If FName = "False" Then MsgBox "You failed to File. This will end the process.", vbOKOnly Exit Sub End If Err.Clear ChildBook = ActiveWorkbook.Name Range("A1:C19").Select 'Whatever range you want Selection.Copy Workbooks(ParentBook).Activate Cells(1,1).Select ActiveSheet.Paste Application.DisplayAlerts = False ActiveWorkbook.Close SaveChanges:=True Application.DisplayAlerts = True '################################### |
All times are GMT +1. The time now is 11:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com