aayaanmayank
Board Regular
- Joined
- Jul 20, 2018
- Messages
- 157
Hi Can anyone help me to make below code shorter as whenever my i run the code along with different set of code, it always gets hang when macro reach to this code.
Sub Groupingname()
Application.ScreenUpdating = False
Set shgroup = ThisWorkbook.Worksheets("Data")
Range("I2").Select
For U = 2 To lastrow1
Set MYNAME0 = Cells((U + 1), ("I"))
Set MYNAME1 = Cells(U, "j")
Set MYNAME2 = Cells(U, "I")
If MYNAME0.Interior.Color = vbYellow Or MYNAME0.Interior.Color = vbGreen And MYNAME0.Value = MYNAME1.Value Then
If IsEmpty(shgroup.Cells((U + 1), ("I"))) = False Then
MYNAME0.Interior.Color = vbGreen
MYNAME1.Interior.Color = vbGreen
MYNAME2.Interior.Color = vbGreen
Else:
End If
End If
Next U
end sub
Sub Groupingname()
Application.ScreenUpdating = False
Set shgroup = ThisWorkbook.Worksheets("Data")
Range("I2").Select
For U = 2 To lastrow1
Set MYNAME0 = Cells((U + 1), ("I"))
Set MYNAME1 = Cells(U, "j")
Set MYNAME2 = Cells(U, "I")
If MYNAME0.Interior.Color = vbYellow Or MYNAME0.Interior.Color = vbGreen And MYNAME0.Value = MYNAME1.Value Then
If IsEmpty(shgroup.Cells((U + 1), ("I"))) = False Then
MYNAME0.Interior.Color = vbGreen
MYNAME1.Interior.Color = vbGreen
MYNAME2.Interior.Color = vbGreen
Else:
End If
End If
Next U
end sub