vba - Input values in a column according to the reference from another column of the same sheet -
hi have problem in inputting values column conditions , referring other 2 or more columns determine input of other column using vba. example there 3 columns called rag cost (c), rag resources (r) , rag benefits (b). 3 columns determine input value in column called overall rag using vba. example if column (c) or column (b) contains value"r" , overall rag status input "a" in respective rows. tried using if else statement doesn't seems work. make clearer example: if rag cost(c) or rag resources(r) values = "r" overall rag status= "a".
you don't need vba can write simple formula
=if(iserror(match("r",b2:d2,0)),"","a")
if want code please try
sub rgb() dim lstrow long dim long dim lastcol long dim j long lstrow = range("b" & sheets("sheet1").rows.count).end(xlup).row lastcol = sheets("sheet1").cells(1, sheets("sheet1").columns.count).end(xltoleft).column = 2 lstrow j = 2 lastcol if activesheet.cells(i, j).value = "r" range("a" & i).value = "a" end if next j next
end sub
Comments
Post a Comment