M
mleone
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.
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.