mercredi 5 août 2015

If Statement in loop - Else, Else If

I'm wondering if anyone could help with the below simple code:

For Each cell In Range(Cells(2, 5), Cells(lastrow1, 5))
    If(cell.offset(, -3)=cell.offset(1,-3)) then cell.value = cell.offset(,-1),else if(cell.offset(, -3)=cell.offset(-1,-3),cell.value = 0,else     cell.valye = cell.offset(,-1))
Next

I'm basically trying to replicate the if statement giving me 3 different outcomes depending on wether the IF statement is true or not.

Aucun commentaire:

Enregistrer un commentaire