jeudi 18 mars 2021

Returning different result when the value is encountered for the 2nd time

I'm using a kind of search function in VBA. I identify the first time a word is in an column I put a value in the column next to it. But the second time the word is in the column I want another value in the column next to it.

Sub Kalender()
    Application.ScreenUpdating = False
    Dim cl As Range
    With ActiveSheet
        For Each cl In Application.Intersect(.Columns("E"), .UsedRange)
            If cl.Value = "Agent" Then
                cl.Offset(, -3).Value = "MONDAY"
        End If
        Next cl
    Application.ScreenUpdating = True
    End With
End Sub

For now I have this but I need to have a second value for the second time column E contains "Agent".

Aucun commentaire:

Enregistrer un commentaire