vendredi 14 juillet 2017

VBA: If statement doesn't work

I have no clue, why the statement doesn't work. No error occurs but at the same time there is no result in the sheet.

 Sub won()
    Dim ws As Worksheet
    Dim lastrow As Long

    Set ws = ThisWorkbook.Sheets("Data imput")
    lastrow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row

    For i = 3 To lastrow
        If ws.Cells(i, 6) = "customer" Then
        ws.Cells(i, 16) = 1
        End If
    Next i

    MsgBox "done!"
End Sub

Aucun commentaire:

Enregistrer un commentaire