Hi Folks,

I've decided to add a comment section to my userform (well tried anyway) but I cant get it to work properly. I would like the comment to appear in the description field when adding a new part.

If anyone can alter the code below to suit, I'd be really greatful


Private Sub cmdAddPart_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Parts List")

'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
    
    'check for a part number
If Trim(Me.txtPartNumber.Value) = "" Then
  Me.txtPartNumber.SetFocus
  MsgBox "Please enter a part number"
  Exit Sub
End If

  
    'check for a Sell Price
If Trim(Me.txtSellPrice.Value) = "" Then
  Me.txtSellPrice.SetFocus
  MsgBox "Please enter the Sell Price!"
  Exit Sub
End If

    'check for a description
If Trim(Me.txtDescription.Value) = "" Then
  Me.txtDescription.SetFocus
  MsgBox "Please enter a Description"
  Exit Sub
End If

  
   'check for a Cost Price
If Trim(Me.txtCostPrice.Value) = "" Then
  Me.txtCostPrice.SetFocus
  MsgBox "Please enter the Cost Price!"
  Exit Sub
End If

 'check for a Comment
If Trim(Me.txtComment.AddComment) = "" Then
  Me.txtComment.SetFocus
MsgBox "Please enter a comment in the text box."
Exit Sub
End If
Me.txtComment.AddComment
Me.txtComment.Comment.Visible = False
Me.txtComment.Comment.Text Text:=txtComment.AddComment

Exit Sub

'copy the data to the database
ws.Cells(iRow, 3).Value = Me.txtPartNumber.Value
ws.Cells(iRow, 2).Value = Me.txtDescription.Value
ws.Cells(iRow, 5).Value = Me.txtCostPrice.Value
ws.Cells(iRow, 4).Value = Me.txtSellPrice.Value
ws.Cells(iRow, 2).AddComment = Me.txtComment.AddComment'

clear the data
Me.txtDescription.Value = ""
Me.txtComment.AddComment = ""
Me.txtSellPrice.Value = ""
Me.txtPartNumber.Value = ""
Me.txtCostPrice.Value = ""
Me.txtPartNumber.SetFocus
Me.txtDescription.SetFocus
Me.txtComment.SetFocus
Me.txtCostPrice.SetFocus
Me.txtSellPrice.SetFocus
End Sub


Private Sub CmdClose_Click()
  Unload Me
End Sub
Kind Regards
Carl