Saving a row from one workbook to another without opening second workbook

shield

New Member
Joined
May 11, 2014
Messages
2
Hello,

I need some help with a macro. What I need it to do is search for the last entered value in column A in a workbook called "data" in a worksheet called "values" and then copy and paste the row to the same row in a workbook called "transfer" in a worksheet called "newvalues." The part that i cant figure out is how to do this without needing to open the second workbook. Also, i need the workbook "transfer" to auto save after the row is pasted, all without ever needing to open the second workbook. Both excel docs are located in the same folder. Any help would be much appreciated. Thanks!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

mrmmickle1

Well-known Member
Joined
May 11, 2012
Messages
2,461
I may be wrong, but I'm pretty sure you will have to open the workbook.

You will need to do something like this:

Code:
Application.Workbooks.Open ("Your File Name")


[COLOR=#008000]'Your Code Here[/COLOR]


Workbooks("Your File Name").Close SaveChanges:=[COLOR=#0000ff]True[/COLOR]

If you do not want to see the workbook opening and closing just use this line at the beginning of your code:

Code:
Application.ScreenUpdating =[COLOR=#0000ff] False[/COLOR]

You will need to set ScreenUpdating back to True at the end of your code.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,606
Messages
5,838,343
Members
430,538
Latest member
PedroOliveira

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
Top