Hoping someone can help.
I am creating a form using Excel and VB and am ttrying to make some of the fileds validate, to make sure the user has filled in all the required fileds before the form is printed.
I am using the code below, but for some reason, is the answer clicked on the Yes/No box is NO, the form deletes out the content of the fileds but doesn't continue on to print.
Can someone please help?
ThanksCode:If Desc2 <> "" And Quant2 = "" Then Msg = "You have entered in a 2nd item Description but not a Quantity." & vbCrLf & vbCrLf & "Did you mean to fill in the 2nd item Description?" Style = vbYesNo + vbExclamation Title = "Warning" Response = MsgBox(Msg, Style, Title) If Response = vbYes Then Range("F55").Select Else Range("A55:H55").Select Selection.ClearContents End If Exit Sub Else End If Sheets("Form").Select Application.ActivePrinter = "CutePDF Writer on CPW2:" ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Sheets("Data").Select Range("C9:d9").Select End Sub




Reply With Quote