打印

[求助] 电子表格2003数据重复问题

0

不单会下片,还会写写码 百分百的原创

打开工具里面的宏。粘贴进去就可以运行了。

Sub perfect()
    '输入
    Dim userInput
        userInput = Application.InputBox("输入需要检查的起始行,结束行,以及需要判断的列,格式如 2,20,C,B")
   
    Dim arrUserInput
        arrUserInput = Split(userInput, ",")
        
     Dim theColumn
          theColumn = arrUserInput(2)
        'theColumn = Asc(arrUserInput(2)) - 64   '进行检验的列

    Dim theStart
        theStart = arrUserInput(0)  '起始行
        
    Dim theEnd
        theEnd = arrUserInput(1) '最后一行的号码.

       If theStart <= 1 Then
       MsgBox "起始行要求大于1"
        End
       End If
      
   
    Dim i   '每一行的号码
    Dim j   '
   

      '排序
                '删除重复行
         
       For i = theStart To theEnd
        For j = i + 1 To theEnd '从当前行至结尾.
             If Cells(i, theColumn) = Cells(j, theColumn) Then
                 Rows(j).Delete
             End If
         Next
       Next
        '删除重复行
End Sub
这是我写的一个宏。适当修改就可以处理你的问题了。运行的时候会卡住。不是死机。耐心等待。

[ 本帖最后由 jaunthe 于 2013-12-5 18:35 编辑 ]
本帖最近评分记录
  • 那成 金币 +5 认真回复,奖励! 2013-12-5 18:54

TOP

当前时区 GMT+8, 现在时间是 2025-3-21 02:15