Macro to pull data from another workbook

Siegmier

New Member
Joined
Jul 29, 2014
Messages
8
OK so here's what i would like to do, and google just hurts my brain so I am going here for the experts, I need to press a button, have excel go into another workbook, which I will update each day with new entries, and pull out the data from that work book and paste it into my current workbook under the data that is currently there, I know I can just copy and paste it myself, but over the long hall this should significantly speed up the process.
also could we make the macro only pull the order's with todays date?

Little more back story in case needed: So I manage the shipments log for our company, and every day we get new sales orders that then go to Document 1, I take those orders from Document 1, move them to Document 2, where we will begin building the order. Once the order is built I move it to sheet 2 inside document 2. I already have a macro to move the data from sheet one to sheet two, and I have tried reading online on how to pull the data, but it seems to all be on keeping the data the same across the two sheets, which frankly neither should match any entries until the import has happened.

Thanks for any help/nudging in the right direction!

-Sieg

Edit: I have excel 2010 and windows 7 incase thats needed! :)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Ok, here's what I have so far,
Code:
Sub adsf()
Dim sFileName As String
    Dim wbTemp As Workbook
    Dim sMacroName As String
    
    sFileName = "Copy of Data input Sample.xlsm"
    sMacroName = "CopyData"
    
    'Set variable, open workbook
    Set wbTemp = Workbooks.Open(sFileName)
    
    'Run macro from other workbook
    Application.Run wbTemp & "!" & sMacroName
    
    'Close workbook, save changes
    wbTemp.Close True

End Sub

then the other code I have set up is:
Code:
Sub CopyData(ByVal Target As Range)
Application.EnableEvents = False_
If Target.Column = 1 And Target.Value = "Jul" Then
Rows(Target.Row).Copy _
Destination:=Workbook("Test").Worksheets("Shipped").Rows(Worksheets("Shipped") _
.UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1)
End If
Application.EnableEvents = True
End Sub

it tells me it can not locate file "Copy of input data sample.xlsm" when I try to run it, I have both files saved to the following path: C:\Users\nklaassen\Desktop\New folder

Any help debugging? or fixing something I haven't seen yet?
 
Upvote 0

Forum statistics

Threads
1,216,745
Messages
6,132,473
Members
449,729
Latest member
davelevnt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top