|
- Sub 查找数据()
- Dim xmrr(), xkrr(), jgrr()
- With Sheets("sheet1")
- .Activate
- hs = .[a1].CurrentRegion.Rows.Count
- ls = .[a1].CurrentRegion.Columns.Count
- Set zbrr = Range(.Cells(2, 2), .Cells(hs, ls))
-
- jghs = [i1].CurrentRegion.Rows.Count
- jgls = [i1].CurrentRegion.Columns.Count
-
- ReDim jgrr(1 To jghs - 1, 1 To jgls - 1)
- For i = 1 To jghs - 1
- czhs = Application.Match(.Cells(i + 1, 9), Range("a2:a" & hs), 0)
- For j = 1 To jgls - 1
-
- czls = Application.Match(.Cells(1, 9 + j), Range("b1:e1"), 0)
- jgrr(i, j) = Application.Index(Range(.Cells(2, 2), .Cells(hs, ls)), czhs, czls)
- Next j
- Next i
- [j2].Resize(jghs - 1, jgls - 1) = jgrr
-
-
- End With
- End Sub
复制代码
楼主代码有错。。。而且,mathc要加0,完全匹配 |
|