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: 1
Default Importing data from one workbook to another programmically


I have two Excel files, one has raw data the other one has all the
functions and formulas in it. I have a button on one of the worksheets
that opens an open file dialog and I can select the source workbook. I
only need a specific range and I don't need to format it or modify it
in any way. The range will also never change.

For instance: On WorkBook A, sheet1 from cells B2 to M9 I have data I
want to copy into WorkBook B, sheet3 cells B7 to M14. The code to
import the data will always reside on WorkBook B.

I need this summoned by a button click which I have, and I have so
far:

Code:
--------------------
Private Sub cmdDataOne_Click()
On Error GoTo foo

Dim InFilename As String

CommonDialog1.CancelError = True
CommonDialog1.DialogTitle = "Open File"
CommonDialog1.Filter = "Excel Files|*.xls|All Files |*.*"
CommonDialog1.Action = 1

InFilename = CommonDialog1.Filename

foo: If Err = 32755 Then Exit Sub

End Sub
--------------------


There are ways I can go about it (recordsets, etc), but it seems like
using a canon to kill a mosquito. I just need a simple copy and paste.
Any help would be apreciated.


--
mleone
------------------------------------------------------------------------
mleone's Profile: http://www.excelforum.com/member.php...o&userid=24295
View this thread: http://www.excelforum.com/showthread...hreadid=379003

 
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 data into a workbook PizzaBoy Excel Worksheet Functions 2 August 23rd 05 02:38 PM
Importing data from a different workbook Mike Excel Worksheet Functions 1 May 5th 05 09:11 PM
Importing Data from unopened Workbook into an open Workbook GrayesGhost Excel Discussion (Misc queries) 0 March 5th 05 11:25 PM
Importing data from another workbook Misterxpro Excel Programming 3 June 1st 04 08:53 PM
Edit Data Query Programmically? Squid[_2_] Excel Programming 5 May 27th 04 10:13 PM


All times are GMT +1. The time now is 01:31 PM.

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"