mercredi 9 novembre 2016

Mixed Conditions VBA

I would need count amount of rows in which when one cell(B2) equals "M" and another cell (B8) is not empty then be resulted as true, but in columns from B to L.

There can be empty cell when there is no "M"in second row.

But still program would recognize row as true.

So, if there are all values in interval in range B:K filled and another cell in same row is "M" then row is fine and program can count and go to next row.

How can I do it programatically please? I am stucked.

Because what I am doing currently is this code:

Do While Application.WorksheetFunction.CountA(Range("B" & Z & ":" & "C" & Z)) > 1 And Application.WorksheetFunction.CountA(Range("E" & Z)) > 0 And Application.WorksheetFunction.CountA(Range("G" & Z)) > 0 And Application.WorksheetFunction.CountA(Range("I" & Z & ":" & "K" & Z)) > 2 ettt = ettt + 1

Z = Z + 1

Loop

Because there has been fixed "M" - mandatory fields. In range B:C, E, G and I:K. But now, I need to do fully flexible code, when Mandatory fields are possible to rewrite to Optional and vice versa. Therefore I need a code like this and my skill/knowledge is not enough to do it and I am not able to find something similar.

How can I do condition Do while I4= "M" and count I8>0 is ok in whole interval and when I4<> M count I8 'doesn`t have to be' >0

Please help.

i am sorry for complicated explanation, it would be better to attach excel and describe what I need based on that. But maybe also this would be enough for someone to help.

Thanks!

Aucun commentaire:

Enregistrer un commentaire