Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default Print report based on criteria

Hi all,
I need to print a report on the work day (Monday through Friday) that is
closest to the 15th of the month. Which means that in April I would print
in on the 13th, May is Tuesday, 15th, June Friday 15, etc. The VBA program
that controls this report also controls others that are run everyday.

How can I code this, probably by setting a variable called PrintReport to
true on the right day.

Any thoughts would be appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Print report based on criteria

Some logic such as shown in this Sub should do it for you.

Sub MidMonthCheck()
Dim MidMonthReportFlag As Boolean

MidMonthReportFlag = False
If Day(Now) = 15 And _
Weekday(Now) < vbSaturday And _
Weekday(Now) < vbSunday Then
'set flag TRUE
'it is 15th and it
'is a weekday
MidMonthReportFlag = True
ElseIf Day(Now) 12 And _
Day(Now) < 15 And Weekday(Now) = vbFriday Then
'set flag TRUE
'it is either 13th, or 14th
'and it's a Friday (with 15th on weekend)
MidMonthReportFlag = True
End If

End Sub


"Rich Mogy" wrote:

Hi all,
I need to print a report on the work day (Monday through Friday) that is
closest to the 15th of the month. Which means that in April I would print
in on the 13th, May is Tuesday, 15th, June Friday 15, etc. The VBA program
that controls this report also controls others that are run everyday.

How can I code this, probably by setting a variable called PrintReport to
true on the right day.

Any thoughts would be appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default Print report based on criteria

That appears to be exactly what I need. I'll test and get back to you.
Thanks.
"JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message
...
Some logic such as shown in this Sub should do it for you.

Sub MidMonthCheck()
Dim MidMonthReportFlag As Boolean

MidMonthReportFlag = False
If Day(Now) = 15 And _
Weekday(Now) < vbSaturday And _
Weekday(Now) < vbSunday Then
'set flag TRUE
'it is 15th and it
'is a weekday
MidMonthReportFlag = True
ElseIf Day(Now) 12 And _
Day(Now) < 15 And Weekday(Now) = vbFriday Then
'set flag TRUE
'it is either 13th, or 14th
'and it's a Friday (with 15th on weekend)
MidMonthReportFlag = True
End If

End Sub


"Rich Mogy" wrote:

Hi all,
I need to print a report on the work day (Monday through Friday) that is
closest to the 15th of the month. Which means that in April I would
print
in on the 13th, May is Tuesday, 15th, June Friday 15, etc. The VBA
program
that controls this report also controls others that are run everyday.

How can I code this, probably by setting a variable called PrintReport to
true on the right day.

Any thoughts would be appreciated.





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
report by DV & date criteria [email protected] Excel Worksheet Functions 2 March 26th 07 10:29 AM
Print Report W/Sub Report Roger Excel Discussion (Misc queries) 0 September 6th 06 10:53 PM
How do i print only the comments for one person on a report? Barb Excel Worksheet Functions 1 August 17th 06 01:03 AM
"Print Report" in Exell 2003 gogaiobashvili Excel Discussion (Misc queries) 1 August 7th 05 05:36 PM
Print part of a viewable report Kris Trester Excel Discussion (Misc queries) 1 July 7th 05 05:11 PM


All times are GMT +1. The time now is 07:38 AM.

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"