Zend certified PHP/Magento developer

How do I only enter information into visible cells with VBA?

I have written a VBA program that automatically filters rows based on user input. Then, the program prompts the user to input (Scan) part numbers one at a time until completion. Right now, it takes the first scanned number and puts it into row 2 and the next in row 3 and so on. How do I program it to put it into the first visible cell, even if this isn’t row 2?

For example:

row  PartScan
 2     22222
 3     33333
 4     44444

Here is what I want it to do:
row  PartScan
 2    
 3
 4     222222 <-first visible cell after the filter

This is the code for this part:

i = 2
PartScan = 1

Do While PartScan <> 0
    PartScan = Application.InputBox(Prompt:="Please scan the next Part. If there are no more Parts, please press Cancel", Type:=1)
    
    Range("G" & i).Value = PartScan
    
    
    i = i + 1
    
Loop 

Basically, How do I set i to be the next visible cell instead of always starting at row 2?