Sub AddNote()
Dim CmntText As String
Dim Ans As String
Dim CmntNum As Long
Do
Ans = Application.InputBox("Entry Date:", "Entry Date:", Date, Type:=2)
If Ans = "" Or Ans = "False" Then
If MsgBox("Entry Date not entered. Skip it?", vbYesNo, "Skip") _
= vbYes Then Exit Do
Else
CmntText = "Entry Date: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
Do
Ans = Application.InputBox("Date received:", "Date received:", Date, Type:=2)
If Ans = "" Or Ans = "False" Then
If MsgBox("Date received not entered. Skip it?", vbYesNo, "Skip") _
= vbYes Then Exit Do
Else
CmntText = CmntText & "Date received: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
Do
Ans = Application.InputBox("Received From:", "Received From:", "John Doe", Type:=2)
If Ans = "" Or Ans = "False" Then
If MsgBox("Received From not entered. Skip it?", vbYesNo, "Skip") _
= vbYes Then Exit Do
Else
CmntText = CmntText & "Received From: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
Do
Ans = Application.InputBox("Batch Number:", "Batch Number:", 999999, Type:=1)
If Ans = 999999 Or Ans = 0 Then
If MsgBox("Batch number not entered. Skip it?", vbYesNo, "Skip") _
= vbYes Then Exit Do
Else
CmntText = CmntText & "Received From: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
Do
Ans = Application.InputBox("Exp Date:", "Exp Date:", Date, Type:=2)
If Ans = "" Or Ans = "false" Then
If MsgBox("Exp Date not entered. Skip it?", vbYesNo, "skip") _
= vbYes Then Exit Do
Else
CmntText = CmntText & "Exp Date: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
Do
Ans = Application.InputBox("Manufacturer Date:", "Manufacturer Date:", Date, Type:=2)
If Ans = "" Or Ans = "False" Then
If MsgBox("Manufacturer Date not entered. Skip it?", vbYesNo, "Skip") _
= vbYes Then Exit Do
Else
CmntText = CmntText & "Manufacturer Date: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
Do
Ans = Application.InputBox("Purpose:", "Purpose:", Date, Type:=2)
If Ans = "" Or Ans = "False" Then
If MsgBox("Purpose not entered. Skip it?", vbYesNo, "Skip") _
= vbYes Then Exit Do
Else
CmntText = CmntText & "Purpose: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
Do
Ans = Application.InputBox("Further Comment:", "Further Comment:", "...", Type:=2)
If Ans = "..." Or Ans = "False" Then
If MsgBox("Further Comment not entered. Skip it?", vbYesNo, "Skip") _
= vbYes Then Exit Do
Else
CmntText = CmntText & "Further Comment: " & Ans & vbLf
Ans = ""
Exit Do
End If
Loop
On Error GoTo NoComment
If ActiveCell.Comment.Text <> "" Then
CmntNum = Int(Len(ActiveCell.Comment.Text) - Len(Replace(ActiveCell.Comment.Text, Chr(10), ""))) / 12
ActiveCell.Comment.Text Text:=ActiveCell.Comment.Text & vbLf & "Receipt #" & CmntNum + 1 & vbLf & CmntText
ActiveCell.Select
End If
Exit Sub
NoComment:
With ActiveCell
.AddComment
.Comment.Visible = True
.Comment.Text Text:="Receipt #1" & vbLf & CmntText
.Select
End With
End Sub
Bookmarks