copy paste cells to another cell from different files

tuesmorning

New Member
Joined
Jul 30, 2010
Messages
6
I know this has been address with using the same file/sheet, but need help since this involves two files.

I have a list of store locator numbers in column B of sheet "Kick List" with the filepath Q:\WORDDATA\ZZZ\ANALYST GROUP\Kick Meeting\Kick List Master.xlsm

I would like to copy and paste each store locator number sequentially into cell H1 of sheet "Temp" from the filepath Q:\WORDDATA\ZZZ\ANALYST GROUP\Kick Meeting\Temp Master.xlsm

Essentially what I wish to do is have a template that uses cell H1 as a reference for vlookups for a report. I want the macro to copy paste the store locator numbers into H1, save a new file, and then change H1 to the next store locator number.

I already have a working the save a new file from ref. cell macro:

Public Sub SaveAsA1()
ThisFile = Range("A1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub

but need help creating this one. Any help would be greatly appreciated! :biggrin:
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

tuesmorning

New Member
Joined
Jul 30, 2010
Messages
6
I found and altered this code but am getting an error

Sub CopyPaste()
Dim Ws1 As Worksheet
Dim Ws2 As Worksheet
Dim Dest As Range
Set Ws1 = Sheets("'[Kick List Master.xlsm]Sheet1'")
Set Ws2 = Sheets("Temp")
Set Dest = Ws2.Range("H1").End(xlDown).Offset(1)
Ws1.Range("'[Kick List Master.xlsm]Sheet1'!$B1:B82").Copy
Dest.PasteSpecial xlPasteValues
Application.CutCopyMode = False
End Sub

error highlights:
Set Ws1 = Sheets("'[Kick List Master.xlsm]Sheet1'")

run-time error '9'
Subscript out of range
 
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,629
Messages
5,838,453
Members
430,549
Latest member
jayjay2022

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