Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro within a Macro help


Hello,

I am creating a macro, that I am running into an error that I can'
figure out how to get around. The macro is basically determining whic
macro needs to be run on a form. Once it runs the necessary macro, i
is jumping onto the next, and then returning an error b/c it is no
supposed to be run. Here is my macro

Sub masteravail()
If WFM.Main1.Value = Sheets("WFM_Update").Range("N8") Then
Avail1
Exit Sub
End If
If WFM.Main1.Value = Sheets("WFM_Update").Range("N9") Then
Avail2
Exit Sub
End If
If WFM.Main1.Value = Sheets("WFM_Update").Range("N10") Then
Avail3
Exit Sub
End If
End Sub
-------------------------------------------------------------------------------
Sub Avail1()
If WFM.Week1.Value = "Sunday" Then
avail1a
Exit Sub
End If
If WFM.Week1.Value = "Monday" Then
avail1b
Exit Sub
End If
If WFM.Week1.Value = "Tuesday" Then
avail1c
Exit Sub
End If
If WFM.Week1.Value = "Wednesday" Then
avail1d
Exit Sub
End If
If WFM.Week1.Value = "Thursday" Then
avail1e
Exit Sub
End If
If WFM.Week1.Value = "Friday" Then
avail1f
Exit Sub
End If
If WFM.Week1.Value = "Saturday" Then
avail1g
Exit Sub
End If
End Sub


When it runs the macro "avail1a", it then attempts to run macr
"avail1b" even tho the exit sub command is there. How can I get aroun
this

--
dok11
-----------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058
View this thread: http://www.excelforum.com/showthread.php?threadid=26371

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Macro within a Macro help

Why don't get rid of the exits altogether and try a Select Case
statement.....

Sub Avail1()

Select Case WFM.Week1.Value
Case "Sunday"
avail1a
Case "Monday"
avail1b
Case "Tuesday"
avail1c
Case "Wednesday"
avail1d
Case "Thursday"
avail1e
Case "Friday"
avail1f
Case "Saturday"
avail1g
End Select

End Sub


--
Charles
www.officezealot.com
"dok112" wrote in message
...

Hello,

I am creating a macro, that I am running into an error that I can't
figure out how to get around. The macro is basically determining which
macro needs to be run on a form. Once it runs the necessary macro, it
is jumping onto the next, and then returning an error b/c it is not
supposed to be run. Here is my macro

Sub masteravail()
If WFM.Main1.Value = Sheets("WFM_Update").Range("N8") Then
Avail1
Exit Sub
End If
If WFM.Main1.Value = Sheets("WFM_Update").Range("N9") Then
Avail2
Exit Sub
End If
If WFM.Main1.Value = Sheets("WFM_Update").Range("N10") Then
Avail3
Exit Sub
End If
End Sub
-------------------------------------------------------------------------------
Sub Avail1()
If WFM.Week1.Value = "Sunday" Then
avail1a
Exit Sub
End If
If WFM.Week1.Value = "Monday" Then
avail1b
Exit Sub
End If
If WFM.Week1.Value = "Tuesday" Then
avail1c
Exit Sub
End If
If WFM.Week1.Value = "Wednesday" Then
avail1d
Exit Sub
End If
If WFM.Week1.Value = "Thursday" Then
avail1e
Exit Sub
End If
If WFM.Week1.Value = "Friday" Then
avail1f
Exit Sub
End If
If WFM.Week1.Value = "Saturday" Then
avail1g
Exit Sub
End If
End Sub


When it runs the macro "avail1a", it then attempts to run macro
"avail1b" even tho the exit sub command is there. How can I get around
this?


--
dok112
------------------------------------------------------------------------
dok112's Profile:
http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=263715



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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


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