' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Sub chageNumbers()
Dim rngReplace As Range, rng As Range
Dim lngRow As Long, lngCol As Long
With ActiveSheet
Set rngReplace = .Range("D1:AI1")
For lngRow = 4 To 123
For lngCol = 3 To 9
If Application.CountIf(.Range(.Cells(lngRow, 2), .Cells(lngRow, lngCol)), .Cells(lngRow, lngCol)) > 1 Then
For Each rng In rngReplace
If IsError(Application.Match(rng, .Range(.Cells(lngRow, 2), .Cells(lngRow, 9)), 0)) Then
.Cells(lngRow, lngCol) = rng
Exit For
End If
Next
End If
Next
Next
End With
End Sub
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Sub chageNumbers()
Dim vntReplace As Variant
Dim lngRow As Long, lngCol As Long, lngI As Long
With ActiveSheet
vntReplace = .Range("D1:AI1")
For lngRow = 4 To 123
For lngCol = 3 To 9 'zweiten Doppler ersetzen
If Application.CountIf(.Range(.Cells(lngRow, 2), .Cells(lngRow, lngCol)), .Cells(lngRow, lngCol)) > 1 Then
Do
lngI = lngI + 1
If lngI > UBound(vntReplace, 2) Then lngI = 1
If IsError(Application.Match(vntReplace(1, lngI), .Range(.Cells(lngRow, 2), .Cells(lngRow, lngCol)), 0)) Then
.Cells(lngRow, lngCol) = vntReplace(1, lngI)
Exit Do
End If
Loop While lngI <= UBound(vntReplace, 2)
End If
Next
Next
End With
End Sub
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Sub chageNumbers()
Dim rngReplace As Range, rng As Range
Dim lngRow As Long, lngCol As Long
With ActiveSheet
Set rngReplace = .Range("D1:AI1")
For lngRow = 4 To 123
For lngCol = 3 To 9
If Application.CountIf(.Range(.Cells(lngRow, 2), .Cells(lngRow, lngCol)), .Cells(lngRow, lngCol)) > 1 Then
For Each rng In rngReplace
If IsError(Application.Match(rng, .Range(.Cells(lngRow, 2), .Cells(lngRow, 9)), 0)) Then
.Cells(lngRow, lngCol) = rng
Exit For
End If
Next
End If
Next
Next
End With
End Sub
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Sub chageNumbers()
Dim vntReplace As Variant
Dim lngRow As Long, lngCol As Long, lngI As Long
With ActiveSheet
vntReplace = .Range("D1:AI1")
For lngRow = 4 To 123
For lngCol = 3 To 9 'zweiten Doppler ersetzen
If Application.CountIf(.Range(.Cells(lngRow, 2), .Cells(lngRow, lngCol)), .Cells(lngRow, lngCol)) > 1 Then
Do
lngI = lngI + 1
If lngI > UBound(vntReplace, 2) Then lngI = 1
If IsError(Application.Match(vntReplace(1, lngI), .Range(.Cells(lngRow, 2), .Cells(lngRow, lngCol)), 0)) Then
.Cells(lngRow, lngCol) = vntReplace(1, lngI)
Exit Do
End If
Loop While lngI <= UBound(vntReplace, 2)
End If
Next
Next
End With
End Sub