excel - Highlight continuous values in column -
i have several column either ok
,[blank]
,fail
(these results generated formulae). note: of these 3 results separated 4 blank cells.
i want continuous cells ok
appearing more 4 times highlighted special formatting. want formatting continue looking cells ok
if blank cell appears stop if fail
appears. after fail want restart counting again.
for instance, in array below string of ok
values appear 5 times continuously (count should not interrupted blank cell) should highlighted. also, please note in array results (ok
,[blank]
,fail
) spaced 4 blank columns.
fail ok ok ok fail fail ok ok ok ok ok ok fail
greatly, appreciate suggestions. thanks.
try this:
sub check4() dim range set = selection.cells(1) n = 0 100 v = a.offset(n, 0).value select case v case "ok": countok = countok + 1 case "": ign = ign + 1 case else countok = 0: ign = 0 end select select case countok case 5 x = n - (4 + ign) n a.offset(x, 0).font.color = colorconstants.vbred next x case > 5 a.offset(n, 0).font.color = colorconstants.vbred end select next n end sub
Comments
Post a Comment