i used vba to filter the sheet. however, i would like to change the value of the column M, the selected column in the picture. my problem is when cant get a way to select hese two cells only which are the result of the filter. i came across a lot of solutions with xltypevisible but that didn't work and it's still selecting everything to the end of the sheet including the filtered ones as well, and changing the value of over 1 million cells.
my code
For Each c In ws.Range("A2:A" & rws)
On Error Resume Next
docnum = c.Value
docdt = c.Offset(0, 2).Value
posamt = c.Offset(0, 1).Value
With rngToFilter
.AutoFilter Field:=3, Criteria1:=docnum
.AutoFilter Field:=6, Criteria1:=docdt
.AutoFilter Field:=8, Criteria1:=posamt * -1
Range("H1").Select
Selection.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
visibletotal = Application.WorksheetFunction.Sum(Selection.SpecialCells(xlCellTypeVisible))
If visibletotal = -1 * posamt Then
Selection.Offset(0, 5).Value = "matched CN"
c.Offset(0, 3).Value = "matched CN"
Else
c.Offset(0, 3).Value = "UNmatched CN"
Selection.Offset(0, 5).Value = "UNmatched CN"
End If
End With
Next c