Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default running multiple macros at once

Hello:

I have four separate macros for a spreadsheet. I want to run all four
macros at once and in a certain order. I want all four macros combined into
one. Here is what I have done to "combine" these macros, so far.

After my first macro, I have put the names of my other three macros. My
first macro runs, but these last three do not.

How can I get all four of these macros to run without the end user having to
run the first macro and then run each of the other three manually and
separately?

Below is my macro. The last three lines are the names of the other three
macros. These other three macros are in the same VBA screen as the combined
macro. So, that's how the combined macro knows where to reference the other
three:

Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(4), _
Replace:=True, PageBreaks:=True, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(4), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Col_Headers
Col_Width
Format_Header

Thanks!

childofthe1980s
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default running multiple macros at once

Are you sure that the others are not erroring out? Put a simple MsgBox at
the start of each and see where you get, or just step through the code.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"childofthe1980s" wrote in
message ...
Hello:

I have four separate macros for a spreadsheet. I want to run all four
macros at once and in a certain order. I want all four macros combined

into
one. Here is what I have done to "combine" these macros, so far.

After my first macro, I have put the names of my other three macros. My
first macro runs, but these last three do not.

How can I get all four of these macros to run without the end user having

to
run the first macro and then run each of the other three manually and
separately?

Below is my macro. The last three lines are the names of the other three
macros. These other three macros are in the same VBA screen as the

combined
macro. So, that's how the combined macro knows where to reference the

other
three:

Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,

Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,

MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(4),

_
Replace:=True, PageBreaks:=True, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(4),

_
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Col_Headers
Col_Width
Format_Header

Thanks!

childofthe1980s



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default running multiple macros at once

Why not just copy the code from your other macros and paste it in the first
macro?

Regards,
Paul

"childofthe1980s" wrote in
message ...
Hello:

I have four separate macros for a spreadsheet. I want to run all four
macros at once and in a certain order. I want all four macros combined
into
one. Here is what I have done to "combine" these macros, so far.

After my first macro, I have put the names of my other three macros. My
first macro runs, but these last three do not.

How can I get all four of these macros to run without the end user having
to
run the first macro and then run each of the other three manually and
separately?

Below is my macro. The last three lines are the names of the other three
macros. These other three macros are in the same VBA screen as the
combined
macro. So, that's how the combined macro knows where to reference the
other
three:

Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(4),
_
Replace:=True, PageBreaks:=True, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(4),
_
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Col_Headers
Col_Width
Format_Header

Thanks!

childofthe1980s



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default running multiple macros at once

use:

Application.Run "Col_Headers"
Application.Run "Col_Width"
Application.Run "Format_Header"

You can always run your macros while recording one to see what the code
would look like.



childofthe1980s wrote:
Hello:

I have four separate macros for a spreadsheet. I want to run all four
macros at once and in a certain order. I want all four macros combined into
one. Here is what I have done to "combine" these macros, so far.

After my first macro, I have put the names of my other three macros. My
first macro runs, but these last three do not.

How can I get all four of these macros to run without the end user having to
run the first macro and then run each of the other three manually and
separately?

Below is my macro. The last three lines are the names of the other three
macros. These other three macros are in the same VBA screen as the combined
macro. So, that's how the combined macro knows where to reference the other
three:

Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(4), _
Replace:=True, PageBreaks:=True, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(4), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Col_Headers
Col_Width
Format_Header

Thanks!

childofthe1980s


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default running multiple macros at once

I tried that. It didn't work.

childofthe1980s

"PCLIVE" wrote:

Why not just copy the code from your other macros and paste it in the first
macro?

Regards,
Paul

"childofthe1980s" wrote in
message ...
Hello:

I have four separate macros for a spreadsheet. I want to run all four
macros at once and in a certain order. I want all four macros combined
into
one. Here is what I have done to "combine" these macros, so far.

After my first macro, I have put the names of my other three macros. My
first macro runs, but these last three do not.

How can I get all four of these macros to run without the end user having
to
run the first macro and then run each of the other three manually and
separately?

Below is my macro. The last three lines are the names of the other three
macros. These other three macros are in the same VBA screen as the
combined
macro. So, that's how the combined macro knows where to reference the
other
three:

Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(4),
_
Replace:=True, PageBreaks:=True, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(4),
_
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Col_Headers
Col_Width
Format_Header

Thanks!

childofthe1980s






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default running multiple macros at once

I'm afraid that that did not work...any other ideas?

childofthe1980s

"trice-nae" wrote:

use:

Application.Run "Col_Headers"
Application.Run "Col_Width"
Application.Run "Format_Header"

You can always run your macros while recording one to see what the code
would look like.



childofthe1980s wrote:
Hello:

I have four separate macros for a spreadsheet. I want to run all four
macros at once and in a certain order. I want all four macros combined into
one. Here is what I have done to "combine" these macros, so far.

After my first macro, I have put the names of my other three macros. My
first macro runs, but these last three do not.

How can I get all four of these macros to run without the end user having to
run the first macro and then run each of the other three manually and
separately?

Below is my macro. The last three lines are the names of the other three
macros. These other three macros are in the same VBA screen as the combined
macro. So, that's how the combined macro knows where to reference the other
three:

Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(4), _
Replace:=True, PageBreaks:=True, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(4), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Col_Headers
Col_Width
Format_Header

Thanks!

childofthe1980s



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default running multiple macros at once

your code works fine here, except the subtotal part, i didn't duplicate that.

what kind of modules is your code in? sheet or code?

can you go to the vbe an press f8 to step through your code and watch what
happens?

comment out everything but the 3 additional macros and see if they run

comment out everything but the sort and see if it works,

try to narrow down what doesn't work
--


Gary

--


Gary


"childofthe1980s" wrote in message
...
I'm afraid that that did not work...any other ideas?

childofthe1980s

"trice-nae" wrote:

use:

Application.Run "Col_Headers"
Application.Run "Col_Width"
Application.Run "Format_Header"

You can always run your macros while recording one to see what the code
would look like.



childofthe1980s wrote:
Hello:

I have four separate macros for a spreadsheet. I want to run all four
macros at once and in a certain order. I want all four macros combined
into
one. Here is what I have done to "combine" these macros, so far.

After my first macro, I have put the names of my other three macros. My
first macro runs, but these last three do not.

How can I get all four of these macros to run without the end user having
to
run the first macro and then run each of the other three manually and
separately?

Below is my macro. The last three lines are the names of the other three
macros. These other three macros are in the same VBA screen as the
combined
macro. So, that's how the combined macro knows where to reference the
other
three:

Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(4),
_
Replace:=True, PageBreaks:=True, SummaryBelowData:=True
Selection.Subtotal GroupBy:=2, Function:=xlCount, TotalList:=Array(4),
_
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Col_Headers
Col_Width
Format_Header

Thanks!

childofthe1980s





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
Running VB macros gwtechie72 New Users to Excel 2 November 12th 07 10:04 PM
Message box with multiple options running different macros Martin Excel Discussion (Misc queries) 3 July 23rd 07 12:19 PM
running macros from IF CJ Excel Worksheet Functions 2 April 30th 06 05:03 PM
Running Macros when on the LAN Bettergains Excel Discussion (Misc queries) 0 October 6th 05 09:38 PM
Running Macros Steve Excel Programming 5 September 21st 04 02:54 PM


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