Copying data into sheet

T

TomBP

In the following pic you see a Save and a Search button.

[image: http://i54.photobucket.com/albums/g115/TomBP/philippe1.jpg]

These buttons are assigned to macro's. When I press the Save button th
current document will be saved as 123456.xls because it saves as th
value located in cell F10. This file is saved in the map shipment
which is located on a shared directory. I save multiple files in thi
map which all have a unique number attached to it.

Now when I want to recall any of those files I use the Search macro
Under the field of the Search button I can fill in one of the uniqu
numbers and it will open the file. Suppose I typed in 123456.xls i
will look like this.

[image: http://i54.photobucket.com/albums/g115/TomBP/philippe2.jpg]

Now instead of opening the files next to my original Receipt Note I
MRN BP.xls I would like to implement the following idea.

When I fill in 123456 in the Search field and press the Search butto
it should copy the data from the 123456.xls file and paste it in th
original Receipt Note I - MRN BP.xls It must only copy paste the dat
from the following cells:

F2-F11
B13-B16
F13-F16
H13-L16
F18-F25
H18-M25
F29-F34
F40-H41
F43-F44

Here you have the macro's I use at the moment.


Code
-------------------
Sub Save()
'
' Save Macro
' Macro recorded 7/07/2006 by BPPassPort User
'
' Keyboard Shortcut: Ctrl+t
'
Dim s As String, s1 As String
s = ActiveSheet.Range("F10").Text
s1 = "Q:\Dist\Philippe\Shipments\"
ActiveWorkbook.SaveCopyAs _
Filename:=s1 & s & ".xls"
End Su
-------------------



Code
-------------------
Sub SearchAndOpen()
'
' SearchAndOpen Macro
' Macro recorded 7/07/2006 by Tom Fack
'
' Keyboard Shortcut: Ctrl+r
'

Dim s1 As String, bk As Workbook, bk1 As Workbook
s1 = "Q:\Dist\Philippe\Shipments\"

Set bk = ActiveWorkbook
If Dir(s1 & Range("B24").Text & ".xls") <> "" Then
Set bk1 = Workbooks.Open(s1 & Range("B24").Text & ".xls")
bk.Activate
Else
MsgBox "workbook not found"
End If

End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top