Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
484 views
in Technique[技术] by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...