0

This is a follow-up question of this thread. May I ask if it is possible to update a cell value after using an Autofilter? So, the flow that I'm thinking of is it will filter the data then update the P9 cell wherein this is the first-row result of the filter, with the value of 1.

Below is the code that I'm trying to modify. This code is similar to this thread but this time I need to update it rather than delete it.

For Each ws In Sheets(Array("N-Q1", "N-Q2", "N-Q3", "N-Q4", "N-D", _
"JK-Q1", "JK-Q2", "JK-Q3", "JK-Q4", "JK-D", "SK-Q1", "SK-Q2", "SK-Q3", "SK-Q4", "SK-D"))    
   With ws.Cells(8, 3).CurrentRegion
     .AutoFilter 2, LRN
     ws.AutoFilterMode = False
   End With         
Next ws

cjvdg
  • 497
  • 2
  • 15

1 Answers1

0

Here's the solution that I made

For Each ws In Sheets(Array("N-Q1", "N-Q2", "N-Q3", "N-Q4", "N-D", _
    "JK-Q1", "JK-Q2", "JK-Q3", "JK-Q4", "JK-D", "SK-Q1", "SK-Q2", "SK-Q3", "SK-Q4", "SK-D"))
    
    lastRow = ws.Cells(Rows.Count, "C").End(xlUp).Row
        
    For r = 9 To lastRow
        
        If ws.Cells(r, 3) = CStr(ThisWorkbook.Sheets("HOME").Range("K11").value) Then
            If ws.Cells(r, 16) = "0" Or ws.Cells(r, 16) = "" Then
                ws.Cells(r, 16) = "1"
                Debug.Print "STUDENTS: " & ws.Cells(r, 3) & "  Verified!"
            Else
                Debug.Print "STUDENTS: " & ws.Cells(r, 3) & "  Already Verified!"
            End If
        End If
    
    Next r
    
    Next ws
cjvdg
  • 497
  • 2
  • 15