Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default 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
'###################################

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
import data from several spreadsheets into one spreadsheet RELIANCE Excel Worksheet Functions 2 January 14th 10 11:30 PM
Import Spreadsheet into Access Jon Excel Worksheet Functions 1 May 30th 08 02:33 PM
How can I import our logo into a spreadsheet? Pam Excel Discussion (Misc queries) 1 November 22nd 06 11:39 PM
Import data to a spreadsheet. Bethany L Excel Discussion (Misc queries) 1 February 3rd 06 05:04 PM
Import of Database VB app into Excel Spreadsheet No Name Excel Programming 0 February 19th 04 06:23 PM


All times are GMT +1. The time now is 11:35 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"