請excel高手幫忙指點迷津

來源: 2009-09-25 06:28:03 [博客] [舊帖] [給我悄悄話] 本文已被閱讀:

我用marcos定義一個cell的值=為vloopup這個cell的橫坐標種坐標在一列數據中的值。但是macros裏麵,

數據:
1-1 05
2-5 02
3-5 02
2-3 05

______________________________________________________
Dim nRow As Integer
Dim nCol As Integer

nRow = 1 '橫坐標
nCol = -1 '縱坐標

Range("G3").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(nRow & nCol,'sheet1'!R21C38:R5000C39,2,FALSE)"
______________________________________________________


反映出來的值是#NAME? 等於 VLOOKUP(nRow & nCol,'TRS31 1007'!$AL$21:$AM$5000,2,FALSE)

而不是我需要的 05 等於 VLOOKUP("1-1",'TRS31 1007'!$AL$21:$AM$5000,2,FALSE)


請問如何改正marcos,讓裏麵的nRow & nCol become 1-1

xiexie thanks a lot