vba - If Statement in loop - Else, Else If -
i'm wondering if below simple code:
for each cell in range(cells(2, 5), cells(lastrow1, 5)) if(cell.offset(, -3)=cell.offset(1,-3)) 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 trying replicate if statement giving me 3 different outcomes depending on wether if statement true or not.
try this;
if (cell.offset(, -3) = cell.offset(1, -3)) cell.value = cell.offset(, -1) elseif (cell.offset(, -3) = cell.offset(-1, -3)) cell.value = 0 else cell.valye = cell.offset(, -1) end if
Comments
Post a Comment