I am getting an error when I try to run a macro to create random alpha-numeric codes in a spread sheet.


Sub NewPass() 
    Do 
        If ActiveCell.Offset(0, -8) <> "" Then 
            ActiveCell.Formula = Chr(Int((26 * Rnd) + 97)) & Format(Int(100000 * Rnd), "00000") 
            ActiveCell.Offset(1, 0).Select 
        Else 
            Exit Sub 
        End If 
    Loop 
End Sub
This is the code and the If ActiveCell.Offset(0, -8) <> "" Then Line has an error (Runtime Error 1004)(Application-defined or object defined error). Someone from this board wrote this code for me and I don't know how to fix it. I am trying to create a password with six characters, a letter first and then five numbers in column I for a name in column F or a Date in Column A (I don't know if it makes a difference).

Can anyone help me with this?