Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Help 'splain unusual behavior in simple procedure

Hi,

I have a module in a workbook. There is a Sub Main() procedure in that
module that simply calls other procedures. It started out like this:

Sub Main()
Call Proc1
End Sub

Sub Proc1()
'Run some code.
End Sub

I have a macro that runs overnight, which opens the workbook and runs
Sub Main. It's all been working fine for about a week. Then I added to
it to make it look something like:

Sub Main()
Call Proc1
If Weekday(Date) = 2 Then Call Proc2
End Sub

Sub Proc1()
'Run some code.
End Sub

Sub Proc2()
'Run some other code.
End Sub

The idea is that the second procedure should only run on Monday.
However, I was seeing unexpected results when I came in the next day.
So I stepped through Sub Main. It totally skipped the first line and
went directly to the If Weekday.... statement. I took out the Call and
stepped through. It worked the way I wanted. It went to Proc1, ran
that code, then came back and ran through the rest of Sub Main.

What's going on, can anyone tell me?

tod
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
3D chart - unusual ORF!N Charts and Charting in Excel 1 September 23rd 09 06:48 PM
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Is there a simple procedure to hide rows if a condition is met fishingengineer Excel Discussion (Misc queries) 1 April 13th 07 08:26 PM
Is there a simple procedure to set my macros in Excel 2003 to be . shelley New Users to Excel 1 April 22nd 05 10:04 PM


All times are GMT +1. The time now is 02:10 PM.

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"