- #1
G
gemaka
Guest
Hallo Ihr Allwissenden.
Habe eine Excel-Datei, die ich laufend ergänze und darin ein Makro, welches doppelte Einträge löscht.
Das ganze lief bisher reibungslos, seit heute wird mir beim ausführen ein->Laufzeitfehler 6' und->Überlauf' angezeigt.
Das Makro:
Sub Doppelt()
'
Cells.Replace What:=: :, Replacement:=:, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Cells.Replace What:=:/, Replacement:=, LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
'
Dim strValue As String
Dim lngCounter As Long
Application.ScreenUpdating = False
For lngCounter = 1 To Cells(Rows.Count, 1).End(xlUp).Row
strValue = Cells(lngCounter, 1).Value
If InStr(1, strValue, ) Then
Cells(lngCounter, 1).Value = _
Trim(Right(strValue, Len(strValue) - WorksheetFunction.Find( , strValue, 1)))
End If
Next lngCounter
Application.ScreenUpdating = True
'
Dim iRow As Integer, iRowL As Integer
iRowL = Cells(Cells.Rows.Count, 1).End(xlUp).Row
For iRow = iRowL To 1 Step -1
If WorksheetFunction.CountIf(Columns(1), Cells(iRow, 1)) > 1 Then
Rows(iRow).Delete
End If
Next iRow
'
Columns(A:A).Select
Selection.Sort Key1:=Range(A1), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub
In Zeile:
iRowL = Cells(Cells.Rows.Count, 1).End(xlUp).Row
soll der Fehler sein.
Kann mir geholfen werden???
Im voraus meinen Dank.
Habe eine Excel-Datei, die ich laufend ergänze und darin ein Makro, welches doppelte Einträge löscht.
Das ganze lief bisher reibungslos, seit heute wird mir beim ausführen ein->Laufzeitfehler 6' und->Überlauf' angezeigt.
Das Makro:
Sub Doppelt()
'
Cells.Replace What:=: :, Replacement:=:, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Cells.Replace What:=:/, Replacement:=, LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
'
Dim strValue As String
Dim lngCounter As Long
Application.ScreenUpdating = False
For lngCounter = 1 To Cells(Rows.Count, 1).End(xlUp).Row
strValue = Cells(lngCounter, 1).Value
If InStr(1, strValue, ) Then
Cells(lngCounter, 1).Value = _
Trim(Right(strValue, Len(strValue) - WorksheetFunction.Find( , strValue, 1)))
End If
Next lngCounter
Application.ScreenUpdating = True
'
Dim iRow As Integer, iRowL As Integer
iRowL = Cells(Cells.Rows.Count, 1).End(xlUp).Row
For iRow = iRowL To 1 Step -1
If WorksheetFunction.CountIf(Columns(1), Cells(iRow, 1)) > 1 Then
Rows(iRow).Delete
End If
Next iRow
'
Columns(A:A).Select
Selection.Sort Key1:=Range(A1), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub
In Zeile:
iRowL = Cells(Cells.Rows.Count, 1).End(xlUp).Row
soll der Fehler sein.
Kann mir geholfen werden???
Im voraus meinen Dank.