aayaanmayank
Board Regular
- Joined
- Jul 20, 2018
- Messages
- 157
Hi All can any one please help me on this.
i need first it has to check that how many times that id exists then based on id count it has to match name rows with similar nuber of times.
e.g. US127473334L id exits 3 times in columns A so then it sud go to column B and match 1st row company name with next two rows/ hope it makes sense.
ID Name
US127473334L ASPHUDSONELECTRICSALESCORP
US127473334L ASPHUDSONELECTRICSALESCORP
US131491494L ASPAGIINDUSAINTR
US131491494L ASPAGIINDUSAINTR
US133929949L ASPJONESLANGLASAC
US133929949L ASPJONESLANGLASAINC
US134399399L ASPCENTRALMONTANAMEDICALINC
US134399399L ASPCENTRALMONTANAMEDICAL
i made a macro but that is working on on compan names row by row.
'FOR Company
Range("F2").Select
ActiveCell.Interior.Color = vbYellow
For U = 2 To LASTROW1
Set MYNAME2 = Cells(U, "f")
Set MYNAME3 = Cells((U + 1), ("f"))
If MYNAME2.Value = MYNAME3 Then
SHGROUP.Cells(U, "f").Interior.Color = vbGreen
SHGROUP.Cells(U + 1, "f").Interior.Color = vbGreen
ActiveCell.Offset(1, 0).Select
Else:
ActiveCell.Offset(1, 0).Select
SHGROUP.Cells(U + 1, "f").Interior.Color = vbYellow
End If
Next U
i need first it has to check that how many times that id exists then based on id count it has to match name rows with similar nuber of times.
e.g. US127473334L id exits 3 times in columns A so then it sud go to column B and match 1st row company name with next two rows/ hope it makes sense.
ID Name
US127473334L ASPHUDSONELECTRICSALESCORP
US127473334L ASPHUDSONELECTRICSALESCORP
US131491494L ASPAGIINDUSAINTR
US131491494L ASPAGIINDUSAINTR
US133929949L ASPJONESLANGLASAC
US133929949L ASPJONESLANGLASAINC
US134399399L ASPCENTRALMONTANAMEDICALINC
US134399399L ASPCENTRALMONTANAMEDICAL
i made a macro but that is working on on compan names row by row.
'FOR Company
Range("F2").Select
ActiveCell.Interior.Color = vbYellow
For U = 2 To LASTROW1
Set MYNAME2 = Cells(U, "f")
Set MYNAME3 = Cells((U + 1), ("f"))
If MYNAME2.Value = MYNAME3 Then
SHGROUP.Cells(U, "f").Interior.Color = vbGreen
SHGROUP.Cells(U + 1, "f").Interior.Color = vbGreen
ActiveCell.Offset(1, 0).Select
Else:
ActiveCell.Offset(1, 0).Select
SHGROUP.Cells(U + 1, "f").Interior.Color = vbYellow
End If
Next U