Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Sequentially run macros

I have several macros which in a module. I tried adding a Function state
with the various subs in between ended by a END Function. It doesn't work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
....Code...
End Sub
Sub Update_Profile
....Code...
End Sub
End Funtion

Please advise.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Sequentially run macros

You can't nest Subs/Functions in the way you tried.
Just do this:

Option Explicit
Function Main_update() ' Sub might be more logical
Update_IMR
Update_Profile
' any other subs you want to run
End Function

Sub Update_IMR()
....Code...
End Sub

Sub Update_Profile
....Code...
End Sub




CurtH wrote:
I have several macros which in a module. I tried adding a Function state
with the various subs in between ended by a END Function. It doesn't work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sequentially run macros

Function Main_update()
Update_IMR
Update_Profile
End Funtion


Sub Update_IMR()
....Code...
End Sub
Sub Update_Profile
....Code...
End Sub
--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I have several macros which in a module. I tried adding a Function state
with the various subs in between ended by a END Function. It doesn't

work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Sequentially run macros

Thanks Andrew for the prompt response. I made the modifications you
instructed as follows:

Function Main_update()
Update_IMR
Update_Profile
Update_OverdueMIL
Update_Imm
Update_Dental
End Function

Sub Update_IMR()
....Code...
End Sub

Sub Update_Profile
.....Code...
End Sub

I then create function button to initate the code. Once I created the
button, I right click to assign the macro and it's not listed. Should I
cread sub calling the Main_Update?


"Andrew Taylor" wrote:

You can't nest Subs/Functions in the way you tried.
Just do this:

Option Explicit
Function Main_update() ' Sub might be more logical
Update_IMR
Update_Profile
' any other subs you want to run
End Function

Sub Update_IMR()
....Code...
End Sub

Sub Update_Profile
....Code...
End Sub




CurtH wrote:
I have several macros which in a module. I tried adding a Function state
with the various subs in between ended by a END Function. It doesn't work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Sequentially run macros

I see you left off the Option Explicit statement. Why? What's you take on
the above question?

"Bob Phillips" wrote:

Function Main_update()
Update_IMR
Update_Profile
End Funtion


Sub Update_IMR()
....Code...
End Sub
Sub Update_Profile
....Code...
End Sub
--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I have several macros which in a module. I tried adding a Function state
with the various subs in between ended by a END Function. It doesn't

work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sequentially run macros

I didn't leave it off on purpose. I am a firm advocate of Option Explicit, I
have it as a default option in my system.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I see you left off the Option Explicit statement. Why? What's you take

on
the above question?

"Bob Phillips" wrote:

Function Main_update()
Update_IMR
Update_Profile
End Funtion


Sub Update_IMR()
....Code...
End Sub
Sub Update_Profile
....Code...
End Sub
--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I have several macros which in a module. I tried adding a Function

state
with the various subs in between ended by a END Function. It doesn't

work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Sequentially run macros

It isn't listed in runnable macros because it's a Function. Change
to a Sub and it should be there

Andrew


CurtH wrote:
Thanks Andrew for the prompt response. I made the modifications you
instructed as follows:

Function Main_update()
Update_IMR
Update_Profile
Update_OverdueMIL
Update_Imm
Update_Dental
End Function

Sub Update_IMR()
....Code...
End Sub

Sub Update_Profile
....Code...
End Sub

I then create function button to initate the code. Once I created the
button, I right click to assign the macro and it's not listed. Should I
cread sub calling the Main_Update?


"Andrew Taylor" wrote:

You can't nest Subs/Functions in the way you tried.
Just do this:

Option Explicit
Function Main_update() ' Sub might be more logical
Update_IMR
Update_Profile
' any other subs you want to run
End Function

Sub Update_IMR()
....Code...
End Sub

Sub Update_Profile
....Code...
End Sub




CurtH wrote:
I have several macros which in a module. I tried adding a Function state
with the various subs in between ended by a END Function. It doesn't work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Sequentially run macros

Oh! Okay...Bob how can I assign this to my button? Do I create another sub
calling the Main_Update function?

"Bob Phillips" wrote:

I didn't leave it off on purpose. I am a firm advocate of Option Explicit, I
have it as a default option in my system.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I see you left off the Option Explicit statement. Why? What's you take

on
the above question?

"Bob Phillips" wrote:

Function Main_update()
Update_IMR
Update_Profile
End Funtion


Sub Update_IMR()
....Code...
End Sub
Sub Update_Profile
....Code...
End Sub
--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I have several macros which in a module. I tried adding a Function

state
with the various subs in between ended by a END Function. It doesn't
work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.







  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sequentially run macros

No just change Main_Update from a function to a sub and assign that.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
Oh! Okay...Bob how can I assign this to my button? Do I create another

sub
calling the Main_Update function?

"Bob Phillips" wrote:

I didn't leave it off on purpose. I am a firm advocate of Option

Explicit, I
have it as a default option in my system.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I see you left off the Option Explicit statement. Why? What's you

take
on
the above question?

"Bob Phillips" wrote:

Function Main_update()
Update_IMR
Update_Profile
End Funtion


Sub Update_IMR()
....Code...
End Sub
Sub Update_Profile
....Code...
End Sub
--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"CurtH" wrote in message
...
I have several macros which in a module. I tried adding a

Function
state
with the various subs in between ended by a END Function. It

doesn't
work.
Does anyone have any suggestions? The code is like thus:

Option Explicit

Function Main_update()

Sub Update_IMR()
...Code...
End Sub
Sub Update_Profile
...Code...
End Sub
End Funtion

Please advise.









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
fill down sequentially JMC Excel Worksheet Functions 1 June 3rd 09 06:55 PM
sorting sequentially Lise Excel Discussion (Misc queries) 4 October 21st 08 03:58 AM
How do you loop NON-SEQUENTIALLY? davidm Excel Programming 4 June 15th 05 06:51 AM
How do you loop NON-SEQUENTIALLY? mangesh_yadav[_311_] Excel Programming 0 June 14th 05 10:02 AM
Run Macros Sequentially William[_2_] Excel Programming 1 June 8th 04 03:21 PM


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