Thanks for the reply Leith. I took your advice and changed the selection.autofilter to cells.autofilter

Fortunately, I managed to find a solution to my problem online.

I'll share it here for everyone else:

Sub DivideBy2()
Dim rng As Range

Set rng = Range("A2", Range("A2").End(xlDown)).Cells.SpecialCells(xlCellTypeVisible)

For Each cell In rng
    cell.Value = cell.Value / 2
Next

End Sub
This code will go through a filtered list in column A starting from cell A2 and down and divide each cell value by 2. note that in my case, all entries in column A are numbers except for cell A1, which is a column header.