1

I have a trigger that when a condition is met inserts values into the next empty row on a worksheet.
The last condition is that another row matching 2 cells in 2 columns on 1 row does not already exist from a previous days.

For i = 2 To LastRowCheck 'EM-ARR1a/SM-ARR1a Letter
    
    If Check.Range("T" & i).Value = 0 And _
      Check.Range("H" & i).Value > 0 And _
      Check.Range("R" & i).Value >= 1 And _
      Check.Range("R" & i).Value <= 5 And _
      Check.Range("Q" & i).Value = True Then
        
        Result.Cells(LastRowResult + 1, "B").Value = Date
        Check.Range("P" & i).Copy
        Result.Cells(LastRowResult + 1, "C").PasteSpecial xlPasteValues
        Result.Cells(LastRowResult + 1, "D").Value = "Coll"
        Result.Cells(LastRowResult + 1, "E").Value = "ACS"
        Result.Cells(LastRowResult + 1, "F").Value = "Letter"
        Result.Cells(LastRowResult + 1, "G").Value = "EM-ARR1a/SM-ARR1a"
        Result.Cells(LastRowResult + 1, "H").Value = "N"

    End If
    On Error Resume Next
        
Next i

The above works but the condition could potentially be true on more than one day. I want to add a condition that checks the Result sheet does not have a row that has the above value in column C and "EM-ARR1a/SM-ARR1a" in column G.

I tried the find method but as far as I can tell, that's for finding one rather than a combination of the two matches. This code is a part of a series of triggers where the id that is in column C and the text in Column G would exist on separate rows.

In essence, I need the condition to say that a row with those two values in those columns does not exist.

Community
  • 1
  • 1
Mariya
  • 19
  • 1
  • Welcome to SO. I'm at work so don't have time for a full answer. There are lots of ways to do this, possibly the easiest is to apply a filter and count the visible rows, like this: https://stackoverflow.com/questions/17285897/row-count-on-the-filtered-data – Absinthe Dec 01 '20 at 14:15

0 Answers0