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

Popular posts from this blog

apache - setting document root in antoher partition on ubuntu -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -