Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Running the second part of a macro only on Thursdays?

Hello,
I have a macro that I run Monday, Tuesday, Wednesday & Friday. Then I have a
second Macro that I run after I run the one mentioned above. My question can
I paste in the second macro in with the first but only have it run on
Thursdays??

Any help is greatly appreaciated,

Lime
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Running the second part of a macro only on Thursdays?

if weekday(date,2) 5 then exit sub
if weekday(date,2) = 4 then ' Thursday
' code for macro 2
else
' code for macro 1
end if

--
Regards,
Tom Ogilvy


"Lime" wrote:

Hello,
I have a macro that I run Monday, Tuesday, Wednesday & Friday. Then I have a
second Macro that I run after I run the one mentioned above. My question can
I paste in the second macro in with the first but only have it run on
Thursdays??

Any help is greatly appreaciated,

Lime

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Running the second part of a macro only on Thursdays?

You can use the Now Function to get the current date and time from your
computer. Then use an if statement to determine if weekday is thursday.

Something like:
If weekday(Now) = 5 Then
macro2
End If

Don't paste the macro into the first one just set it to run at the end of
your if statement. Just make sure both macros are in the same module or
workbook.

"Lime" wrote:

Hello,
I have a macro that I run Monday, Tuesday, Wednesday & Friday. Then I have a
second Macro that I run after I run the one mentioned above. My question can
I paste in the second macro in with the first but only have it run on
Thursdays??

Any help is greatly appreaciated,

Lime

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
Running the second part of a macro only on Thursdays? Lime Excel Programming 0 June 7th 06 05:49 PM
Thursdays dates between 04/16/06 - 05/15/06 Carla Excel Worksheet Functions 9 May 6th 06 05:22 PM
Is there a function to return all Thursdays in a given month/yr Week Dates from nth day of week Excel Worksheet Functions 11 August 11th 05 05:09 AM
Jump Thursdays in a month pankaj_zen Excel Discussion (Misc queries) 10 June 6th 05 02:44 PM
Is it possible to grab just the Mondays-Thursdays of every month? Arlen Excel Discussion (Misc queries) 5 January 4th 05 08:29 PM


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

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

About Us

"It's about Microsoft Excel"