I am looking for a way in VBA to enter a unique order number value I.E. DHOrd000x or VndOrd000x into the first blank cell in column A. I already have the code to enter in the rest of the order values, just looking for a way to generate a unique order number when submitting the order onto the sheet. The code for the submission I have now is...
Private Sub Save_Click()
lastrow = Range("C" & Rows.Count).End(xlUp).Row
Range("B" & lastrow + 1).Value = TTNum.Text
Range("C" & lastrow + 1).Value = Req.Text
Range("D" & lastrow + 1).Value = ReqD.Text
Range("F" & lastrow + 1).Value = DH.Text
Range("G" & lastrow + 1).Value = DHNum.Text
Range("H" & lastrow + 1).Value = DHCst.Text
Range("R" & lastrow + 1).Value = Rsn.Text
MsgBox "One record written to Sheet1"
response = MsgBox("Do you want to enter another record?", _
vbYesNo)
If response = vbYes Then
Req.Text = ""
ReqD.Text = ""
DHNum.Text = ""
Req.SetFocus
Else
Unload Me
End If
End Sub
Can this be done in code? Any help is greatly appreciated, thank you.
Bookmarks