#1   Report Post  
Posted to microsoft.public.excel.programming
luc luc is offline
external usenet poster
 
Posts: 15
Default import data

how can I import data from another excel file into an existing excel file.
what would the code look like.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default import data

Turn on the macro recorder.
Open both files
copy and paste from one worksheet to another (different workbooks)
stop the recording

look at the code.

I think if you do something like this, you'll see the workbook/worksheet names
that you need.

Post back with any questions you have after you do it.

===
This is what I would do with both workbooks open.

dim fRng as range
dim tRng as range

with workbooks("book1.xls").worksheets("sheet1")
set frng = .range("a1:g9")
end with

with workbooks("book2.xls").worksheets("sheet1")
set trng = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

frng.copy _
destination:=trng

===

It copies the range, but pastes to the first available cell in column A of the
second worksheet.



luc wrote:

how can I import data from another excel file into an existing excel file.
what would the code look like.


--

Dave Peterson
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 XML data...Is there a size limit on the import? MatthewG Excel Discussion (Misc queries) 0 February 10th 09 05:57 PM
How to Start Excel in Text Import Wizard for data import rlelvis Setting up and Configuration of Excel 0 July 10th 08 08:40 PM
Import external data, data includes Excel function allen davidson Excel Worksheet Functions 0 July 4th 08 12:39 PM
Tool bar: Data/Import external data/New database query Daniel Setting up and Configuration of Excel 3 February 28th 08 08:40 AM
how to Import data in excel office2003 with data more 65000 rows Abhijit Excel Worksheet Functions 1 May 13th 05 05:12 AM


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