Compare two lists and change row colour
Solved/Closed
dagoun
-
9 Feb 2010 à 11:48
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 9 Feb 2010 à 19:51
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 9 Feb 2010 à 19:51
Related:
- Compare two lists and change row colour
- Beyond compare - Download - File management
- How to merge and compare two excel files - Guide
- Saints row 2 cheats - Guide
- How to change text colour html - Guide
- Rj45 colour code - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
9 Feb 2010 à 19:51
9 Feb 2010 à 19:51
I am assuming that the barcode columns both sheet 1 and sheet 2 are the same
then try this code
at the beginning when you run the code, the code will ask an input about the column letter of the barcode. you can type the column letter e.g. G and click ok (on the top right)
the macro is
then try this code
at the beginning when you run the code, the code will ask an input about the column letter of the barcode. you can type the column letter e.g. G and click ok (on the top right)
the macro is
Sub test()
Dim col As String, r As Range, c As Range, cfind As Range
Dim x, y As Integer
col = InputBox("type the column LETTER in which the barcode is netered for e.g. G")
On Error Resume Next
With Worksheets("sheet2")
Set r = Range(.Cells(2, col), .Cells(2, col).End(xlDown))
For Each c In r
x = c.Value
With Worksheets("sheet1").Columns(col & ":" & col)
Set cfind = .Cells.Find(what:=x, lookat:=xlWhole)
If cfind Is Nothing Then GoTo nnext
y = cfind.Interior.ColorIndex
cfind.EntireRow.Copy
With Worksheets("sheet3")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
.Cells(Rows.Count, col).End(xlUp).Interior.ColorIndex = y
End With
End With
nnext:
Next c
End With
End Sub