Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying data into sheet
In the following pic you see a Save and a Search button. [image: http://i54.photobucket.com/albums/g1...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/g1...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 ------------------- Thanks in advance for your tim -- TomB ----------------------------------------------------------------------- TomBP's Profile: http://www.excelforum.com/member.php...fo&userid=3611 View this thread: http://www.excelforum.com/showthread.php?threadid=56196 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need help Taking alot data from one sheet (if not blank) and copying toa list on another sheet. | Excel Worksheet Functions | |||
copying only selected data from Sheet 1 to Sheet 2 | Excel Worksheet Functions | |||
Copying the repeated data of the previous sheet to the next sheet | Excel Discussion (Misc queries) | |||
Copying Data from one sheet to another sheet on a specific day | Excel Worksheet Functions | |||
2 questions, copying data from sheet to sheet and assigning macro | Excel Worksheet Functions |