How to remove only the duplicate row instead of removing all the rows that follows the duplicate row in VBA?

大城市里の小女人 提交于 2021-02-08 11:30:24

问题


I wanted to remove only the row that is identified as duplicate with some condition. But, the problem I am facing right now is I am getting all the rows below the duplicate row getting deleted with the coding I have. Hence, I loose all the entries that are below the duplicate row in a different table. Hope you get my problem.

Please suggest a proper VBA code for this situation. I have given the code that I am using.

Private Sub CommandButton2_Click()
    Dim rng As Range
    Set rng = ThisWorkbook.Sheets("Sheet1").UsedRange
    rng.RemoveDuplicates Columns:=1, Header:=xlYes
End Sub

Sample Table Image - Blue Rectangle indicates the region boundaries (only within row 15 column E rectangle duplicate removal should happen

来源:https://stackoverflow.com/questions/65630126/how-to-remove-only-the-duplicate-row-instead-of-removing-all-the-rows-that-follo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!