Search code examples
excelvbaexcel-formulaexcel-2010

Selecting first and next cell in filtered criteria range


I want to select next cell in Filtered range using VBA

For example, Column A having set of values and column B having set of values, I have to filter column B and criteria is Sunday for eg.,

for Sunday I want to re-write as Noted down.

I tried this code also With ActiveSheet.AutoFilter.Range Range("B" & .Offset(1, 0).SpecialCells(xlCellTypeVisible)(1).Row).Select

End with

I am getting error of Application defined or object defined error.

We cant even simply move to next cell in filtered range? Any easy way is there to move to first and next cell in filtered criteria?

enter image description here

enter image description here


Solution

  • Try this... It will update each cell for filtered data in c column...

    Sub code()
    
    Range("A1").Select
    Selection.AutoFilter
    Set Rng = ActiveSheet.Range("$A$2:$C$10")
    Rng.Columns(3).ClearContents
    Rng.AutoFilter Field:=2, Criteria1:="Sunday"
    
    For Each cell In Rng.Columns(3).Cells.SpecialCells(xlCellTypeVisible)
        cell.Value = "Noted Down"
    Next cell
    Selection.AutoFilter
    
    End Sub
    

    enter image description here