还是让合适的工具来做最适合的工作吧,以前我先用bat来处理数据,发现效率太低了,后来又用bat调用vbs处理,感觉没那么顺手,接触到vba后,哈哈,有了相见恨晚的感觉...
我想,可能batman还不知道excel里有一个叫做vba(快捷键为Alt+F8)的东西吧,用VBE(快捷键Alt+F11)编写的,用下面的代码(vba)就高效多了,哈哈... | Option Explicit | | | | Sub JustDoIt() | | Dim AllColumns As Integer, AllRows As Integer, i As Integer, j As Integer, ADuty As Integer, Info As String, _ | | Info2 As String | | AllColumns = Range("iv1").End(xlToLeft).Column | | AllRows = Range("a65536").End(xlUp).Row | | For i = 2 To AllColumns - 2 | | Info = "" | | ADuty = 0 | | For j = 2 To AllRows | | If Cells(j, i) > 0 Then | | ADuty = ADuty + Cells(j, i) | | Else | | Info = Info & Cells(j, 1) & "," | | End If | | Next | | If Info = "" Then Info = "无" | | Cells(i, AllColumns + 1) = Cells(1, i) & ADuty & ", 完成为 0 的局: " & Info | | Next | | Info = "当日排名: " | | Info2 = "当月累计排名: " | | For i = 1 To AllRows | | For j = 2 To AllRows | | If Cells(j, AllColumns - 1) = i Then Info = Info & Cells(j, 1) & i & "," | | If Cells(j, AllColumns) = i Then Info2 = Info2 & Cells(j, 1) & i & "," | | Next | | Next | | Cells(AllColumns, AllColumns + 1) = Info & vbCrLf & Info2 | | Columns(AllColumns + 1).AutoFit | | Cells(AllColumns, AllColumns + 1).Select | | End SubCOPY |
|