Hello
I need some help please.
I am using the following code:
However the final message box code does not work, I get "The Total Invoice Value is... 0", but in my test Profit is 1,000.
I have also tried using a named range within Excel (called "Profit"), which refers to "Deal Sheet" worksheet, and cell C32 (all in the same workbook)
I am sure this is a simple fix, but it appears to escape me at present.
Thanks
I need some help please.
I am using the following code:
Code:
LastDeal = Sheets("Data").Range("A1").End(xlDown).Row - 1
Cost = Sheets("Data").Range("E1").End(xlDown).Row - 1
SaleValue = Sheets("Data").Range("Q1").End(xlDown).Row - 1
Profit = Val(SaleValue) - Val(Cost)
Sheets("Deal Sheet").Select
Range("E2").Select
ActiveCell.Value = LastDeal
'ask if want to print deal sheet
Response = MsgBox("Do you want to print the Deal Sheet?", vbYesNo, "Print")
Select Case Response
Case vbYes
'Sheets("Deal Sheet").Select
'Range("E2").Select
'ActiveCell.Value = LastDeal
ActiveWindow.SelectedSheets.PrintOut 1, 1, copies:=1
Case vbNo
MsgBox "You will need to print out the Deal Sheet for Deal... " & LastDeal, vbExclamation, Warning
End Select
'ask if an Invoice has been rasied
Response = MsgBox("Have you raised an Invoice?", vbYesNo, "Invoice")
Select Case Response
' if yes then place the invoie number in the relevant cell
Case vbYes
Invoice = InputBox("What is the Invoice Number?", "Invoice")
With Sheets("Data")
With .Cells(.Rows.Count, "A").End(xlUp).Offset(0, 0)
.Offset(0, 34).Value = Invoice
End With
End With
' if not yet rasied, then remind user to rasie the invoice, and quote the profit
Case vbNo
MsgBox "You need to raise an Invoice for Deal... " & LastDeal & vbNewLine & "The Total Invoice Value is:... " & Profit, vbOKOnly
End Select
However the final message box code does not work, I get "The Total Invoice Value is... 0", but in my test Profit is 1,000.
I have also tried using a named range within Excel (called "Profit"), which refers to "Deal Sheet" worksheet, and cell C32 (all in the same workbook)
I am sure this is a simple fix, but it appears to escape me at present.
Thanks