LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default VBA - Importing Sheets

Hi,

I got a question for VBA in Excel 2003:

I have different .xls-files in a folder. I need to import some data from the
most up-to-date .xls-file in this folder into a new .xls-file

Example:
In the folder "xy" there is the file "sep_09.xls". I need to copy all the
data from the worksheets 1, 2 & 3 to my file "new.xls" (also to the
worksheets 1, 2 & 3)
By pushing a button in my file "new.xls" I want to get those worksheets from
"sep_09.xls" imported into the different worksheets of "new.xls".

At the moment I am using a code, which only can import one separate worksheet:

Code:
 

Option Explicit 
Sub Import_Sheet1() 
   Dim fname As Variant 
    
   fname = Application.GetOpenFilename("XLS-Dateien,*.xls") 
   If fname < False Then 
      With ActiveSheet 
         Workbooks.Open fname 
         Worksheets(1).UsedRange.Copy .Range("Sheet1!B10") 
         ActiveWorkbook.Close False 
        End With 
        End If 
End Sub
For the second worksheet I use a second button with the same code (but:
"worksheets(2)" and ("Sheet2!B10").

How can I manage it to import different worksheets at the same time with one
"central button"?
 
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
Importing from CSV over multiple sheets Verity Excel Programming 5 November 16th 05 03:44 AM
IMPORTING SHEETS Rebecca New Users to Excel 3 June 29th 05 01:04 PM
Importing data from several sheets, to one chart Martin Thorgaard Charts and Charting in Excel 2 January 6th 05 03:07 PM
importing sheets el_peacock Excel Programming 0 November 21st 04 04:09 PM
Excel VBA - Importing columns from different sheets Gaston[_2_] Excel Programming 0 January 29th 04 12:41 AM


All times are GMT +1. The time now is 09:48 AM.

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"