C
C Brandt
I'm having some basic difficulty nagivating through books and sheets.
I am in a workbook and intending on copying and pasting a couple of pages
form another wookbook into this workbook.
Using "GetOpenFilename" I identify and subsequently open a workbook. Copy
all cells from a sheet and paste values into my calling workbook. This works
just fine.
Question #1: Is there a way to identify the name and path of the calling
workbook?
I currently, have it hard coded, but since the name changes as I rev the
sheet, it is labor intensive.
I then want to go back to the called workbook, open another sheet and
copy/paste it back into the calling wookbook.
When I activate the workbook containing the data, it says the Subscript is
out-of-range.
Question # 2: Why am I getting the subscript out of range?
Thanks for any help,
Craig
' Request current TradeSheet filename
TSFileName = Application.GetOpenFilename
Workbooks.Open (TSFileName)
Sheets("Funds").Select
' Copy the sheet
Cells.Copy
' Bring back original sheet and paste values into this sheet
Workbooks("Account Review-Rev c.xls").Activate ' SEE QUESTION # 1
Sheets("Funds_DL").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues
' Message the sheet (deleted)
' Copy over Buy Sheet
Workbooks(TSFileName).Activate ' SEE QUESTION # 2
Sheets("Buy").Select
Cells.Copy
Workbooks("Account Review-Rev c.xls").Activate
Sheets("Buy").Select
Selection.PasteSpecial Paste:=xlPasteValues
I am in a workbook and intending on copying and pasting a couple of pages
form another wookbook into this workbook.
Using "GetOpenFilename" I identify and subsequently open a workbook. Copy
all cells from a sheet and paste values into my calling workbook. This works
just fine.
Question #1: Is there a way to identify the name and path of the calling
workbook?
I currently, have it hard coded, but since the name changes as I rev the
sheet, it is labor intensive.
I then want to go back to the called workbook, open another sheet and
copy/paste it back into the calling wookbook.
When I activate the workbook containing the data, it says the Subscript is
out-of-range.
Question # 2: Why am I getting the subscript out of range?
Thanks for any help,
Craig
' Request current TradeSheet filename
TSFileName = Application.GetOpenFilename
Workbooks.Open (TSFileName)
Sheets("Funds").Select
' Copy the sheet
Cells.Copy
' Bring back original sheet and paste values into this sheet
Workbooks("Account Review-Rev c.xls").Activate ' SEE QUESTION # 1
Sheets("Funds_DL").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues
' Message the sheet (deleted)
' Copy over Buy Sheet
Workbooks(TSFileName).Activate ' SEE QUESTION # 2
Sheets("Buy").Select
Cells.Copy
Workbooks("Account Review-Rev c.xls").Activate
Sheets("Buy").Select
Selection.PasteSpecial Paste:=xlPasteValues