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:
 

Some videos you may like

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,388
Messages
5,511,037
Members
408,823
Latest member
TJKnight

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top