计算机一级重复缴费,计算机一级考试:Excel中删除重复数据

a91a1099ce6644a145a0c3a5f7ca3abb.png

请仔细阅读并修改相关数据。

1、打开有重复数据的EXCEL

2、Alt+F11 打开宏编辑器

3、左边双击:ThisWorkBook

4、贴入以下代码并运行即可:

Sub 删除重复数据()

'删除col列的重复数据

'本例是删除标题为sheet1的EXCEL表中A列(从A2单元格开始)的重复数据

Application.ScreenUpdating = False

'可根据实际情况修改下面三行的结尾值

Dim sheetsCaption As String: sheetsCaption = "Sheet1"

Dim Col As String: Col = "A"

Dim StartRow As Integer: StartRow = 2

'以下不需要修改

Dim EndRow As Integer: EndRow = Sheets(sheetsCaption).Range(Col & "65536").End(xlUp).Row

Dim Count_1 As Integer: Count_1 = 0

Dim count_2 As Integer: count_2 = 0

Dim i As Integer: i = StartRow

With Sheets(sheetsCaption)

Do

Count_1 = Count_1 + 1

For j = StartRow To i - 1

If .Range(Col & i) = .Range(Col & j) Then

Count_1 = Count_1 - 1

.Range(Col & i).EntireRow.Delete

EndRow = Sheets(sheetsCaption).Range(Col & "65536").End(xlUp).Row

i = i - 1

count_2 = count_2 + 1

Exit For

End If

Next

i = i + 1

Loop While i < EndRow + 1

End With

MsgBox "共有" & Count_1 & "条不重复的数据"

MsgBox "删除" & count_2 & "条重复的数据"

Application.ScreenUpdating = True

End Sub

5、按F5键运行即可

2829f2ca24f0d0090cbba57f30759f23.png

计算机一级考试:Excel中删除重复数据.doc

下载Word文档到电脑,方便收藏和打印[全文共692字]

编辑推荐:

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

下载Word文档

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值