Hello everyone,

i need a help on this one.... I encoded a macro that will simply get the difference of the two column with the use of "DO" and "LOOP" function. But if the cell contains a text data it generates an error and stops the macro. here is my macro:

Private Sub CommandButton2_Click() 
    On Error Goto okay 
    Dim Cell As Range 
     
    Set Cell = Range("av3") 
    Do Until Cell.Offset(0, -1).Value = "" 
        Cell.Value = Cell.Offset(0, -1).Value - Cell.Offset(0, -5).Value 
        Set Cell = Cell.Offset(1, 0) 
    Loop 
     
okay: 
    Cell.Value = Cell.Offset(0, -5).Value 
     
     
End Sub
How should it appear if i want that the formula will continue until cell.offset(0,-1).value = "" even if along the way there is an error (in this case there is a text data in the cell)?

Thanks!