Hello everybody.
I need to achieve the following;
When executing macro Check_Info I want to check if cell AR1 is missing and return info msg Customer Name is missing, then stop running macro, I AR1 has data then check if cell W17 is empty, if so return info msg Delivery date is missing. Then a condition statement would you like to carry on wihout a delivery date? If yes then continue running macro if not then stop macro (I believe End Sub???? If carry on then check next cell AW17 if empty then info msg Processed By field is empy, and stop running macro.
What am I doing wrong here?
I have managed to have msg error for Customer name empty but this is only showing when there is data in the cell?
Any help appreciated.
Regards,
Albert
Sub Check_Info()
If Range("AR1").Value <> Empty Then
MsgBox "Customer Name is missing."
Exit Sub
End If
If Range("AY73").Value > 0 Then
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Sheets("Saved Invoices").Unprotect Password:="15951"
Dim Data(1 To 4) As Variant
Dim DstRng As Range
Dim RngEnd As Range
Set DstRng = Worksheets("Saved Invoices").Range("A2:D2")
Set RngEnd = DstRng.Parent.Cells(Rows.Count, DstRng.Column).End(xlUp)
Set DstRng = IIf(RngEnd.Row < DstRng.Row, DstRng, RngEnd.Offset(1, 0).Resize(1, 4))
With Worksheets("Invoice")
Data(1) = .Range("L17") 'Invoice number
Data(2) = .Range("A17") 'Date
Data(3) = .Range("AR1") 'Customer
Data(4) = .Range("AY73") 'Amount
End With
DstRng = Data
Sheets("Saved Invoices").Protect Password:="15951"
ActiveWindow.Zoom = 80
Range( _
"AR1:BG1,W17:AI17,AW17:BG17,I20:AD67,AI20:AK67,AU20:AX67,AY20:BA67,G70:T70,AA70:AK70,G71:AK71,G74:P74,G75:P75,Z74:AK74,Z75:AK75" _
).Select
Range("Z75").Activate
Selection.ClearContents
Range("AR1:BG1").Select
ActiveWindow.Zoom = 150
Sheets("Invoice").Unprotect Password:="15951"
With Range("L17")
.NumberFormat = "00000"
.Value = .Value + 1
End With
Sheets("Invoice").Protect Password:="15951"
ActiveWorkbook.Save
Else
MsgBox "ATENTION!!! Invoice cannot be printed if total is £00.0."
End If
End Sub
Bookmarks