Running the second part of a macro only on Thursdays?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top