MyTetra Share
Делитесь знаниями!
DelDub
Время создания: 16.03.2019 23:43
Текстовые метки: RemoveDuplicates, удаление дубликатов
Раздел: Разные закладки - VBA - Excel - Range
Запись: xintrea/mytetra_db_adgaver_new/master/base/14828440277gahpdzmxj/text.html на raw.githubusercontent.com

'================================================================================

Sub DelDub()

Dim ColsArr(), i&

With ActiveSheet.ListObjects(1)

ReDim ColsArr(.ListColumns.Count - 1)

For i = 1 To .ListColumns.Count

ColsArr(i - 1) = i

Next

.Range.RemoveDuplicates (ColsArr), xlYes

End With

End Sub

'================================================================================

Sub DelDub1()

Dim oSh As Worksheet

Dim ColsArr(), i&

Set oSh = ActiveSheet

With oSh

Lng_RowEnd = .Columns(1).Rows(1048576).End(xlUp).Row

Lng_ClnEnd = .Cells(1, 256).End(xlToLeft).Column


strRangeAddress = Range(.Cells(1, 1), .Cells(Lng_RowEnd, Lng_ClnEnd)).Address

ReDim ColsArr(Lng_ClnEnd - 1)

For i = 1 To Lng_ClnEnd

ColsArr(i - 1) = i

Next

.Range(strRangeAddress).RemoveDuplicates (ColsArr), xlYes

End With

End Sub

'================================================================================

 
MyTetra Share v.0.65
Яндекс индекс цитирования