Need some macro codes

Z

zen65

I have two separate macro programs:
1. Run_Daily() - which is run each day, Monday to Friday.
2. Run_Weekly() - which is run only on Friday.
How can I combine them into a single program so that they still run
correctly?
Thank you for any help.

zen65
 
J

Jim Cone

Something like this?...
'--
Sub DailyProgram()
'Existing code followed by...
If WeekDay(Date, vbSunday) = vbFriday Then
Call WeeklyProgram
End If
End Sub
'--
Sub WeeklyProgram()
'Existing code here
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"zen65" <[email protected]>
wrote in message
I have two separate macro programs:
1. Run_Daily() - which is run each day, Monday to Friday.
2. Run_Weekly() - which is run only on Friday.
How can I combine them into a single program so that they still run
correctly?
Thank you for any help.
zen65
 
Z

zen65

So, now I have to run only the "DailyProgram" and it automatically takes
care of the "WeeklyProgram". That sounds great! Much appreciate your help.
Thank you Jim.

zen65
 
J

Jim Cone

zen65,
You are welcome.
The code assumes that your calendar week starts on Sunday.
(that is what the "vbSunday" tells Excel)
Also, both macros should be in the same module or the weekly
macro in a general/regular module.
You might want to set your computer clock to a Friday
and test it before relying on it.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel add-ins; some free and some for sale)


message
So, now I have to run only the "DailyProgram" and it automatically takes
care of the "WeeklyProgram". That sounds great! Much appreciate your help.
Thank you Jim.
zen65
 
L

Letzdo_1t

I'm trying to do the same thing as Zen65, but don't have any date requirements.
I just want my other macros within the same workbook to execute when I run
this
macro. What would the code look like?

Thanks,
James
 
Top