C
C Brandt
Here is what I am trying to accomplish:
I have a spreadsheet where I would like to pull in parameters from another
spreadsheet.
I first used "GetOpenFileName" to get the name and path of the data file
then inserted this in a string that identifies the data that I am looking
for..
TSFileName = Application.GetOpenFilename(Title:="Open Current Trades
Sheet")
BuyStr = "'[" & TSFileName & "]Buy'!$A$8:$CL$500"
SellStr = "'[" & TSFileName & "]Sell'!$A$8:$CL$500"
MMStr = "'[" & TSFileName & "]Funds'!$B$8:$AE$500"
I used "formula" to populate the target cells then copied the values.
Range("I8").Formula = "=VLOOKUP($H8," & BuyStr & ",82,0)"
Range("J8").Formula = "=VLOOKUP($H8," & SellStr & ",82,0)"
Range("K8").Formula = "=VLOOKUP($H8," & MMStr & ",27,0)"
Range("L8").Formula = "=VLOOKUP($H8," & MMStr & ",26,0)"
Range("I8:L8").Select
Selection.AutoFill Destination:=Range("I8:L" & MaxRtn & ""),
Type:=xlFillDefault
Range("I8:L" & MaxRtn & "").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues
Here is what MMStr looks like:
'[C:\Documents and Settings\Craig Brandt\My Documents\MTA Working\Qtrly
Statement\Q407\Trades Sheet - 11-26-07.xls]Funds'!$B$8:$AE$500
Here is an example of the code generated for the Vlookup in J8.
=VLOOKUP($H8,'[C:\Documents and Settings\Craig Brandt\My Documents\MTA
Working\Qtrly Statement\Q407\[Trades Sheet - 11-26-07.xls]Buy]Trades Sheet -
11-26-07.xls]Buy'!$A$8:$CL$500,82,0)
Clearly, this is not correct. Why the double reference to the filename.
Help!
Craig
I have a spreadsheet where I would like to pull in parameters from another
spreadsheet.
I first used "GetOpenFileName" to get the name and path of the data file
then inserted this in a string that identifies the data that I am looking
for..
TSFileName = Application.GetOpenFilename(Title:="Open Current Trades
Sheet")
BuyStr = "'[" & TSFileName & "]Buy'!$A$8:$CL$500"
SellStr = "'[" & TSFileName & "]Sell'!$A$8:$CL$500"
MMStr = "'[" & TSFileName & "]Funds'!$B$8:$AE$500"
I used "formula" to populate the target cells then copied the values.
Range("I8").Formula = "=VLOOKUP($H8," & BuyStr & ",82,0)"
Range("J8").Formula = "=VLOOKUP($H8," & SellStr & ",82,0)"
Range("K8").Formula = "=VLOOKUP($H8," & MMStr & ",27,0)"
Range("L8").Formula = "=VLOOKUP($H8," & MMStr & ",26,0)"
Range("I8:L8").Select
Selection.AutoFill Destination:=Range("I8:L" & MaxRtn & ""),
Type:=xlFillDefault
Range("I8:L" & MaxRtn & "").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues
Here is what MMStr looks like:
'[C:\Documents and Settings\Craig Brandt\My Documents\MTA Working\Qtrly
Statement\Q407\Trades Sheet - 11-26-07.xls]Funds'!$B$8:$AE$500
Here is an example of the code generated for the Vlookup in J8.
=VLOOKUP($H8,'[C:\Documents and Settings\Craig Brandt\My Documents\MTA
Working\Qtrly Statement\Q407\[Trades Sheet - 11-26-07.xls]Buy]Trades Sheet -
11-26-07.xls]Buy'!$A$8:$CL$500,82,0)
Clearly, this is not correct. Why the double reference to the filename.
Help!
Craig