|
求教,目的就是在Range("G5,G27:G33,G38:G39,G46:G48,G53:G55,G60:G88,G94")依次查找前10大数字,然后把这10值及对应信息写入以下区域
| A列 | B列 | C列 | D列 | E列 | F列 | 102行 | 名称 | | 累计数 | | | 同期数 | 103行 | XX | | 10000 | | | 5022 | 104行 | XXX | | 8000 | | | 581 | 105行 | XXXX | | 7000 | | | 696532 | 106行 | XXXSAW | | 6000 | | | 21320 | 107行 | WE | | 5000 | | | 52321 | 108行 | XA | | 4000 | | | 256 | 109行 | 你 | | 3000 | | | 23145 | 110行 | 莽 | | 2000 | | | 52132 | 111行 | 角 | | 1000 | | | 5120 | 112行 | 相去甚远 | | 500 | | | 5654 |
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
Dim a
If Target.Row = 100 And Target.Column = 1 Then
For i = 1 To 10
If Application.Large(Range("G5,G27:G33,G38:G39,G46:G48,G53:G55,G60:G88,G94"), i) > 0 Then
Cells(i + 102, 3) = Application.Large(Range("G5,G27:G33,G38:G39,G46:G48,G53:G55,G60:G88,G94"), i)
Cells(i + 102, 1) = Cells(Application.Large(Range("G5,G27:G33,G38:G39,G46:G48,G53:G55,G60:G88,G94"), i).Row, 1)
Cells(i + 102, 6) = Cells(Application.Large(Range("G5,G27:G33,G38:G39,G46:G48,G53:G55,G60:G88,G94"), i).Row, 16)
End If
Next
End If
End Sub
请问以上代码为红色字体部分执行后没有结果写入相应的单元格?请大侠指教
|
|