|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim i&
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With GetObject(ThisWorkbook.path & "" & Cells(1, 1) & ".xls")
- Range(Worksheets(2).Cells(4, 43 + Int(Right(Worksheets(1).Cells(1, 1), 2))), Worksheets(2).Cells(4, 43 + Int(Right(Worksheets(1).Cells(1, 1), 2))).End(3).Offset(1, 0)).ClearContents
- For i = 2 To .Worksheets(1).Cells(65536, 1).End(3).Row
- For j = 2 To Worksheets(2).Cells(65536, 1).End(3).Row
- If .Worksheets(1).Cells(i, 10) = Worksheets(2).Cells(j, 2) Then
- Worksheets(2).Cells(j, 43 + Int(Right(.Worksheets(1).Cells(i, 2), 2))) = Worksheets(2).Cells(j, 43 + Int(Right(.Worksheets(1).Cells(i, 2), 2))) + .Worksheets(1).Cells(i, 6)
- Worksheets(2).Cells(j, 43 + Int(Right(.Worksheets(1).Cells(i, 2), 2))).NoteText .Worksheets(1).Cells(i, 1)
- End If
- Next
- Next
- .IsAddin = True
- .IsAddin = False
- .Close True
- End With
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码 这样行不行。 |
|