jmeddaugh,
Welcome to the forum!
Why a textbox? A user can manually change its contents. I think it would be better if you used a label. So assuming you replace the textbox with a label named lblGenerate, something like this snippet should work for you:
![]()
Private Sub cmdGenerate_Click() Dim lID As Long Do lID = Int(Rnd() * 9999) + 10100001 If Columns("B").Find(lID, , xlValues, xlWhole) Is Nothing Then Exit Do Loop Me.lblGenerate.Caption = lID End Sub
Bookmarks