Results 1 to 4 of 4

Thread: Excel VB Form

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    1

    Excel VB Form

    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?
    Code:
    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
    Thanks
    Last edited by Hack; Jul 20th, 2009 at 06:25 AM. Reason: Added Code Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width