LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 4
Default Macro stops running if date is not in past...

Sorry everybody but when I thought I was getting to grasps with this it's all going down the hill.

The code bellow checks for;

W17 which is a delivery date field. This is working correct. It displays message if date is in the past.

Now the problem is, if date is in the past I get message and if ok then the macro runs to the next step and checks for cell AX17 processed by.

Now if date is not in the past the macro does not carries on to check AX17, it just stops...

Where in the code bellow am I going wrong please?

Thank you.

Albert

Code:
Else    If Range("W17") = Empty Then 'Checks if there is a delivery date.
        MsgBox "Please add a delivery date!", vbInformation, "Delivery date..."
        Range("W17").Select
                
        Else
        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 'Exit Sub*****************------------------
        Range("w17").Select
    Else
    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.
    Else
    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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code Stops Running Instead of Debugging [email protected] Excel Discussion (Misc queries) 1 December 10th 08 07:15 PM
Macro stops running at an unexpected time Barb Reinhardt Excel Programming 2 November 17th 08 05:30 AM
Excel VBA Macro stops running when another program is activated Brody Excel Programming 5 June 23rd 06 07:42 PM
why excel stops running?? usiddiqi Excel Discussion (Misc queries) 2 May 17th 06 10:14 AM
Macro stops running after file has moved LWhite Excel Programming 1 January 4th 05 07:44 PM


All times are GMT +1. The time now is 04:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"