aayaanmayank
Board Regular
- Joined
- Jul 20, 2018
- Messages
- 157
Hi Can any one help me on this? i have below data which need to compare with the next row and give green color if 80% text matches
image removed
i have written below code but excel is getting hang whenever i run the Macro
sub colorr()
Set shgroup = ThisWorkbook.Worksheets("Grouping Data_Underwriters")
lastrow1 = shgroup.Range("B" & Rows.Count).End(xlUp).Row
Range("B2").Select
For U = 2 To lastrow1
Set MYNAME2 = Cells(U, "B")
Set MYNAME3 = Cells((U + 1), ("B"))
MY = Left(MYNAME2, Len(MYNAME2) * 0.8)
x = Len(MY)
y = Left(MYNAME3, x)
If y = MY Then
shgroup.Cells(U, "B").Interior.Color = vbGreen
shgroup.Cells(U + 1, "B").Interior.Color = vbGreen
End If
Next U
END SUB
image removed
i have written below code but excel is getting hang whenever i run the Macro
sub colorr()
Set shgroup = ThisWorkbook.Worksheets("Grouping Data_Underwriters")
lastrow1 = shgroup.Range("B" & Rows.Count).End(xlUp).Row
Range("B2").Select
For U = 2 To lastrow1
Set MYNAME2 = Cells(U, "B")
Set MYNAME3 = Cells((U + 1), ("B"))
MY = Left(MYNAME2, Len(MYNAME2) * 0.8)
x = Len(MY)
y = Left(MYNAME3, x)
If y = MY Then
shgroup.Cells(U, "B").Interior.Color = vbGreen
shgroup.Cells(U + 1, "B").Interior.Color = vbGreen
End If
Next U
END SUB
Last edited by a moderator: