Results 1 to 5 of 5

Thread: Macro stops running if date is not in past...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Member rollis13's Avatar
    Join Date
    Nov 2012
    Posts
    36
    Rep Power
    0
    Just break it down al litle more to:
    Code:
    Sub test()
        If Range("W17") = Empty Then 'Checks if there is a delivery date.
            MsgBox "Please add a delivery date!", vbInformation, "Delivery date..."
            Range("W17").Select
            Exit Sub
        End If
        If Range("W17").Value < Date Then
            answer = MsgBox("The delivery date is set in the past." & vbNewLine & "Click OK if date is correct." & vbNewLine & "Click Cancel to change.", vbQuestion + vbOKCancel, "Delivery date!")
            If answer = vbCancel Then
                Range("W17").Select
                Exit Sub
            End If
        End If
        If Range("AX17") = Empty Then 'Checks if there is who processed invoice.
            MsgBox "Please select Processed By!", vbInformation, "Processed by..."
            Range("AX17").Select
        Else
            If Range("AZ73").Value = 0 Then
                MsgBox "Invoice cannot be £0.00!", vbInformation, "Invoice total..." 'Checks invoice total must be greater than 0.
                Exit Sub
            End If
            Application.ActivePrinter = "doPDF v7 on DOP7:" 'Selects doPDF to genarate PDF file of invoice.
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            "E:\Lusa\Generated Invoices\INV" & Range("L17").Text & ".pdf", _
            Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas _
            :=False, OpenAfterPublish:=False
            If Application.Dialogs(xlDialogPrinterSetup).Show Then
            End If
        End If
    End Sub
    Last edited by rollis13; 03-10-2013 at 04:22 AM.

Similar Threads

  1. Replies: 5
    Last Post: 06-15-2013, 12:40 PM
  2. Saving and Running Macro For Multiple Files / Users
    By Charles_ in forum Excel Help
    Replies: 1
    Last Post: 01-07-2013, 09:10 AM
  3. Workbook Event running VBA question
    By jamilm in forum Excel Help
    Replies: 4
    Last Post: 12-29-2012, 12:12 AM
  4. Running a VBA in all excel files
    By msiyab in forum Excel Help
    Replies: 3
    Last Post: 12-26-2012, 01:35 PM
  5. Copy and Past as picture/bitmap in email body form excel.
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 0
    Last Post: 12-05-2012, 09:56 PM

Posting Permissions

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