vba - split a value from a range of column and color the duplicate value using vb macro -
i have bolow requirement of had achieved few still need help
- if status in g column = ready retest or passed
- then if there values in column c, take/split duplicate id in column c separated comma(,)
- search duplicate id in column , mark green color
[![example data][1]][1]
ex. in row 1 defect id cms-921 there 2 duplicate id 44 , 163693. need values in column a.
- if status of defects (44 , 163693) not closed need mark entire row in green color
example of current code:
sub findduplicatecolorit() last row dim report worksheet dim integer, j integer dim lastrow integer set report = excel.worksheets("sheet2") lastrow = report.usedrange.rows.count application.screenupdating = false = 2 lastrow j = 2 lastrow if report.cells(i, 4).value <> ""_ , report.cells(i, 7).value = "ready retest"_ , report.cells(i, 1).value = "jira" 'this omit blank cells @ end '(in event column lengths not equal). if instr(1, report.cells(j, 2).value, report.cells(i, 3).value, vbtextcompare) > 0 ' need logic need value colum d, 'split , find value in column , color row green/any. = split(activecell.value, ",") text = 0 ubound(a) msgbox a(text) next text exit else end if end if next j next application.screenupdating = true end sub
venkat ... use example of logic. need add things avoid / capture errors, sure.
sub findduplicatecolorit() dim report worksheet dim a() string dim long, j long dim lastrow long, chkrow long set report = excel.worksheets("sheet3") lastrow = report.usedrange.rows.count application.screenupdating = false = 2 lastrow if report.cells(i, 4).value <> "" , _ (instr(report.cells(i, 7).value, "ready retest") > 0 or _ instr(report.cells(i, 7).value, "passed") > 0) , _ instr(report.cells(i, 1).value, "jira") > 0 'this omit blank cells @ end (in event column lengths not equal. = split(report.cells(i, 3).value, ",") j = 0 ubound(a) chkrow = report.range("b1:b" & lastrow).find(a(j)).row if chkrow > 0 if not instr(report.cells(chkrow, 7).value, "closed") > 0 debug.print report.range("a" & i).address report.range("a" & i).entirerow.interior.color = vbgreen end if end if next j end if next application.screenupdating = true end sub
Comments
Post a Comment