想要比較當天與前一天的值併爲每個項目逐行突出顯示重複值,我的數據有幾行,並且我有每天從文本文件導入數據的宏。 測試數據:突出顯示重複匹配下一列
這裏是我想要的代碼:
子重複()
Dim refRng As Range, cell As Range
Application.ScreenUpdating = False
With Worksheets("Sheet1")
Set refRng = .Range("B2", .Cells(.Rows.Count, "F").End(xlUp)).SpecialCells(XlCellType.xlCellTypeConstants)
For Each cell In .Range("C2", .Cells(.Rows.Count, "D").End(xlUp)).SpecialCells(XlCellType.xlCellTypeConstants)
If cell.value <> 0 Then
If Not refRng.Find(what:=cell.value, LookIn:=xlFormulas, lookat:=xlWhole, MatchCase:=False) Is Nothing Then cell.Interior.color = RGB(255, 255, 0)
End If
Next cell
End With
Application.ScreenUpdating = True
結束子
用您的編碼項目的當前狀態更新您的問題。如果你沒有告訴我們你確切的問題,我們不能給你一個確切的解決方案。有關一般問題的一般指導原則,請參閱下面的答案。 –
[這裏有一個類似的問題,也許你可以在這裏找到答案! =)](https://stackoverflow.com/questions/2162684/ms-excel-how-to-create-a-macro-to-find-duplicates-and-highlight-them) – flowers1234
更新的問題與代碼 – sumit