Advertisement
YasserKhalil2019

T4008_RemoveDuplicates Method In Dynamic Approach

Sep 28th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. https://excel-egy.com/forum/t4008
  2. ---------------------------------
  3.  
  4. Sub RemoveDuplicates_Method_In_Dynamic_Approach()
  5. Dim ws As Worksheet, rng As Range, a(), i As Long
  6.  
  7. Set ws = ThisWorkbook.Sheets(1)
  8. Set rng = ws.Range("A4").CurrentRegion
  9. ReDim a(0 To rng.Columns.Count - 1)
  10. For i = 0 To rng.Columns.Count - 1: a(i) = i + 1: Next i
  11.  
  12. rng.RemoveDuplicates Columns:=(a), Header:=xlYes
  13. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement