Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Beforeprint with multiple If then else statements

By combing through discussion groups and experimenting for days, I've
come up with the following. It works as a macro or a "click" event. I
would like to use it as a BeforePrint procedure, but it either stops
after the message box, runs through the second if twice, doesn't print
at all, prints twice, etc.
Sub test()

If Range("y43").Value + Range("y17").Value < "80" Then
If MsgBox("The total of 'REGULAR' and 'LOST TIME' hours must equal
80. Please correct your timesheet.", _
vbOKOnly, "") = vbOK Then End
End If

If MsgBox("You have not entered miscellaneous hours such as Vacation,
Jury Duty, etc. Is this correct?", _
vbYesNo, "") = vbNo Then
MsgBox ("Please correct your timesheet.")


ElseIf Range("y25").Value = "" Then
ActiveSheet.PageSetup.PrintArea = "$A1:$y66"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Else: ActiveSheet.PageSetup.PrintArea = "$A1:$y129"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

End If

End Sub

If possible I would also like to add and If then else statement based
on the following formula:

=IF(OR((AND(HolidayHours=1,SUM(sheet1:sheet4!Y21:Y 22)=29)),
(AND(HolidayHours=2,SUM(Op1:test!Y21:Y22)=32)),
(AND(HolidayHours=0,SUM(Op1:test!Y21:Y22)=26))),"" ,"please check
hours")


I don't even know if I'm asking a lot since I don't really know what
I'm doing; but thanks for whatever help you can give!

Venus

Reply
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
BeforePrint Robin Clay Excel Programming 4 February 13th 07 03:48 PM
BeforePrint help Rookie 1st class Excel Programming 4 November 19th 05 09:57 PM
BeforePrint Add In Daniel McCollick[_2_] Excel Programming 10 June 10th 05 08:07 PM
ADO 2.7 & ADO 2.8 beforeprint JCanyoneer Excel Programming 7 March 30th 05 04:05 PM
Help with BeforePrint Eric[_7_] Excel Programming 2 October 9th 03 07:44 PM


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

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

About Us

"It's about Microsoft Excel"