excel vba - Evaluate Corresponding Elements in Two Arrays and Increment Counter if Conditions Are Met -


in vba setting array1 equal range in worksheet. passing different array2 worksheet vba. want simultaneously iterate through elements in arrays , check if 2 conditions simultaneously met: array1 contains string "sat pad" , array2 contains blank. if conditions met, increment counter , return value function call. note below array2 same size array1. example, array2 range u5:u28. here failed code:

function countsatpads(byref array2() range) integer  dim integer, count integer dim array1()  count = 0 array1 = sheets("summary").range("b5:b28")  = lbound(array1) ubound(array1)     if array1(i) = "sat pad" , array2(i) <> ""         count = count + 1     end if next  countsatpads = count 

end function


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -