Hi all,
Is there a better way of doing the following that avoids nesting if statements? Basically I'm building up a bit of code - prior to this I'm given a row number. I then check the row number for "string1". Where I find "string1" I would also like to check if the three cells below that address also contain "string1".
which would look at little like
But that seems a very long-winded method for checking related cells. I'm looking for a method where I can easily specify the number of offset equivalents to check (e.g. 5 would check 5 cells below (or including) the original cell)
Thanks all!
Is there a better way of doing the following that avoids nesting if statements? Basically I'm building up a bit of code - prior to this I'm given a row number. I then check the row number for "string1". Where I find "string1" I would also like to check if the three cells below that address also contain "string1".
which would look at little like
VBA Code:
If Cell.value="string1" and cell.offset(1,0).value="string1" and cell.offset(2,0).value="string1" and cell.offset(3,0).value="string1" then...
But that seems a very long-winded method for checking related cells. I'm looking for a method where I can easily specify the number of offset equivalents to check (e.g. 5 would check 5 cells below (or including) the original cell)
Thanks all!