Hello evryone,
I would like to have a duplicate checks on a column ( C column in my case) repeating itself every 15 seconds at the opening of the excel file or each time the user add a data into the column ( C column after the opening )
I know that for the macro to start executing at the opening, I have to put it in " This workbook" MEO.
The timer can be done with sth like this application.OnTime When:=Now + TimeValue("0:" + "0" + "30")
For the repeating part, I read that I could use a GoTo or do an infinite loop
The Macro that I would like to repeated is a duplicate check in the columns
- If duplicate, the rows should be highlighted in red.
- If the duplicate is removed, the rows should not be highlighted anymore.
I'm a bit lost. Could you help me figure where is my error ? Thanks you for you time and helpSub dupli_check()
Dim xMin As String
repeat:
Dim LastRow As Long
ActiveSheet.Select
LastRow = ActiveSheet.UsedRange.Rows.Count
For r = 6 To LastRow
If WorksheetFunction.CountIf(Range("C6:C" & LastRow), Cells(r, 3).Value) > 1 And Cells(r, 3).Value <> "" Then
Rows(r).Interior.ColorIndex = 3
ElseIf WorksheetFunction.CountIf(Range("C7:C" & LastRow), Cells(r, 3).Value) < 1 Or Cells(r, 3).Value = "" Then
Rows(r).Interior.ColorIndex = 2
Next r
Else
Application.OnTime Now() + TimeValue("0:" + "0" + "30"), "repeat"
GoTo repeat
End Sub
Br,
Martin
Bookmarks