Dia dhaoibh,
Chun luachanna dúblacha a bhaint as gach 10 gcill, déan mar a leanas le do thoil:
- I do bhileog oibre, brúigh Eile + F11, cliceáil ansin Ionsáigh > Modúil;
- Cóipeáil an cód thíos, agus é a ghreamú go dtí an bosca modúl;
- Preas F5 chun an cód a rith, ansin feicfidh tú a Kutools le haghaidh Excel dialóg mar a thaispeántar thíos:
- Téigh ar ais go dtí do bhileog oibre, agus roghnaigh an raon. Ansin cliceáil ar an OK cnaipe ar an dialóg.
Sub RemoveDuplicatesValue_10()
Dim xSltRg, xCells, xRg As Range
Dim xStartRg, xEndRg As Range
Dim xSInt, xCount, xRntInt, xNumInt, xF As Integer
On Error Resume Next
xSInt = 10
Set xSltRg = Application.InputBox("Select range:", "Kutools for Excel", , , , , , 8)
If xSltRg Is Nothing Then Exit Sub
Set xSltRg = Application.Intersect(ActiveSheet.UsedRange, xSltRg)
Set xSltRg = Application.Union(xSltRg, xSltRg.Item(1))
xCount = xSltRg.Count
xNumInt = Int(xCount / xSInt)
xRntInt = 0
xRntInt = xCount Mod xSInt
For xF = 1 To xNumInt
Set xStartRg = xSltRg.Item(((xF - 1) * xSInt + 1))
Set xEndRg = xSltRg.Item(xF * xSInt)
Set xCells = xSltRg.Worksheet.Range(xStartRg.AddressLocal & ":" & xEndRg.AddressLocal)
For xInt = xCells.Count To 1 Step -1
Set xRg = xCells.Item(xInt)
If WorksheetFunction.CountIf(xCells, xRg.Value) > 1 Then
xRg.Value = ""
End If
Next
Next
If xRntInt > 0 Then
Set xStartRg = xSltRg.Item(xNumInt * xSInt + 1)
Set xEndRg = xSltRg.Item(xCount)
Set xCells = xSltRg.Worksheet.Range(xStartRg.AddressLocal & ":" & xEndRg.AddressLocal)
For xInt = xCells.Count To 1 Step -1
Set xRg = xCells.Item(xInt)
If WorksheetFunction.CountIf(xCells, xRg.Value) > 1 Then
xRg.Value = ""
End If
Next
End If
End Sub
Tabhair faoi deara, chun luachanna dúblacha a bhaint as gach N-chealla, athraigh an 10 sa chód go N.
Amanda