取单元格范围并将范围应用于索引匹配

时间:2020-02-03 10:17:01

标签: excel vba indexing match

我正在使用两个名为Sheet1和Sheet2的工作表

Worksheets("SMSv2").Activate
Dim smsv2 As Range
Dim rng As Range
Dim arrayRange As Variant

Set smsv2 = ActiveSheet.Range("A2")
Set rng = Range(smsv2, smsv2.End(xlToRight))
Set rng = Range(rng, rng.End(xlDown))

arrayRange = Range(rng).Value

arrayRange = Range(rng).Value

'Go back to Sheet1
Worksheets("Sheet1").Activate

'Enter  index match
Range("N2").Select
ActiveCell.FormulaR1C1 = _
    "=INDEX(Sheet2!arrayRange,MATCH(Sheet1!RC[-11],Sheet2!arrayRange,0),4)"

如何正确地将arrayRange包含在索引函数中以获取值?

0 个答案:

没有答案