Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Run macro on excel open if after certain time

I already use this code to execute a macro if the date is Friday. I
want to amend it so that it will run only if it is before 11:00
If (Weekday(Now) = vbFriday) And Sheet5.Range("fri_weather").Value =
"" Then [Friday]

Thanks for nay help you may provide.

Thanks, Steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Run macro on excel open if after certain time

One way:

If Sheet5.Range("fri_weather") = vbNullString Then _
If WeekDay(Date) = vbFriday Then _
If Time < TimeSerial(11, 0, 0) Then _
[Friday]

In article om,
"Steve" wrote:

I already use this code to execute a macro if the date is Friday. I
want to amend it so that it will run only if it is before 11:00
If (Weekday(Now) = vbFriday) And Sheet5.Range("fri_weather").Value =
"" Then [Friday]

Thanks for nay help you may provide.

Thanks, Steve

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Run macro on excel open if after certain time

Try something like:

Sub tcheck()
Dim v As Double
v = Now()
tm = v - Int(v)
If tm 0.45833 Then
MsgBox ("too late - after 11:00 AM")
Else
MsgBox ("its before 11:00 AM")
End If
End Sub

--
Gary's Student
gsnu200704


"Steve" wrote:

I already use this code to execute a macro if the date is Friday. I
want to amend it so that it will run only if it is before 11:00
If (Weekday(Now) = vbFriday) And Sheet5.Range("fri_weather").Value =
"" Then [Friday]

Thanks for nay help you may provide.

Thanks, Steve


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Run macro on excel open if after certain time

On Feb 8, 8:41 am, JE McGimpsey wrote:
One way:

If Sheet5.Range("fri_weather") = vbNullString Then _
If WeekDay(Date) = vbFriday Then _
If Time < TimeSerial(11, 0, 0) Then _
[Friday]

In article om,



"Steve" wrote:
I already use this code to execute a macro if the date is Friday. I
want to amend it so that it will run only if it is before 11:00
If (Weekday(Now) = vbFriday) And Sheet5.Range("fri_weather").Value =
"" Then [Friday]


Thanks for nay help you may provide.


Thanks, Steve- Hide quoted text -


- Show quoted text -


Thank You Very Much JE . It works perfectly ! Steve

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
When i open excel file it takes time to open Muraliraj Menon Excel Discussion (Misc queries) 1 May 23rd 07 12:50 PM
Open workbook macro if time is between??? buzzharley[_8_] Excel Programming 3 July 6th 06 05:09 PM
Can Excel open a new application every time you open a file? shoon Setting up and Configuration of Excel 0 December 13th 05 03:28 PM
open up an excel program with an auto open macro [email protected] Excel Programming 2 July 17th 05 04:48 PM
How do I stop Excel from closing the open file each time I open a. Welsin Setting up and Configuration of Excel 3 January 8th 05 11:16 PM


All times are GMT +1. The time now is 02:02 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"