Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default How to chain VBA applications

Is there anyway these 2 codes can be chained to execute consecutively
Other than by Application.Run€¦.€¦If possible, I do not want to change
the original codes. Thank You.
' SALES Macro
' Macro recorded 4/25/2006

Dim i As Long
For i = 10201 To 10320 Step 8
Cells(i, "J").Resize(7).FormulaR1C1 = _
"=SUMPRODUCT(--(R6C6:R10006C6=RC9),--(R6C4:R10006C4=R10200C),R6C32:R10006C32)"
Cells(i + 7, "J").FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)" 'TOTAL FOR GROUP
Next i

Range("J10201:J10320").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
====================================
' FUS1 Macro
' Macro recorded 4/25/2006
'
Dim i As Long
For i = 10322 To 10337 Step 8
Cells(i, "J").Resize(7).FormulaR1C1 = _
"=SUMPRODUCT(--(R6C6:R10006C6=RC9),--(R6C26:R10006C26=R10200C),--(R6C27:R10006C27=""MYR"")*(R6C30:R10006C30))"
Cells(i + 7, "J").FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)" 'TOTAL FOR GROUP
Next i

Range("J10322:J10337").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default How to chain VBA applications

Hi Robert

Just call the second macro in the last line before the End Sub of the
Sales macro.

Sub Sales()
....
....
Application.CutCopyMode = False

Call FUSI
End Sub()
--
Regards

Roger Govier


"Robert" wrote in message
...
Is there anyway these 2 codes can be chained to execute consecutively
Other than by Application.Run...If possible, I do not want to change
the original codes. Thank You.
' SALES Macro
' Macro recorded 4/25/2006

Dim i As Long
For i = 10201 To 10320 Step 8
Cells(i, "J").Resize(7).FormulaR1C1 = _
"=SUMPRODUCT(--(R6C6:R10006C6=RC9),--(R6C4:R10006C4=R10200C),R6C32:R10006C32)"
Cells(i + 7, "J").FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)" 'TOTAL FOR GROUP
Next i

Range("J10201:J10320").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
====================================
' FUS1 Macro
' Macro recorded 4/25/2006
'
Dim i As Long
For i = 10322 To 10337 Step 8
Cells(i, "J").Resize(7).FormulaR1C1 = _
"=SUMPRODUCT(--(R6C6:R10006C6=RC9),--(R6C26:R10006C26=R10200C),--(R6C27:R10006C27=""MYR"")*(R6C30:R10006C30))"
Cells(i + 7, "J").FormulaR1C1 = "=SUM(R[-7]C:R[-1]C)" 'TOTAL FOR GROUP
Next i

Range("J10322:J10337").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
--
Robert



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default How to chain VBA applications

Thanks Roger but your way is exactly as "Application.Run('FUS1").
--
Robert


"
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to chain VBA applications

In what way? It runs the macros true, but it is a different command, which
is what you asked for? What does Application.Run do that you don't want?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Robert" wrote in message
...
Thanks Roger but your way is exactly as "Application.Run('FUS1").
--
Robert


"



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default How to chain VBA applications

If you don't want to change the original code of either macro, then try
creating a third function that call the first two in order:

Sub ChainMyMacros()
Call Macro1
Call Macro2
End Sub

"Robert" wrote:

Thanks Roger but your way is exactly as "Application.Run('FUS1").
--
Robert


"



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default How to chain VBA applications

What I was looking for was to combine the 2 codes into one. The suggestions
from Roger and Rayo are acceptable and will be used. Thanks Bob.
--
Robert



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
emergency/snow chain jackieb162 Charts and Charting in Excel 1 October 30th 08 01:08 AM
Chain IF formula help Dave Excel Worksheet Functions 4 June 27th 08 12:04 AM
Eliminate blanks before a charachter chain MónicaM[_2_] Excel Programming 2 April 22nd 06 03:26 AM
Excel VBA - Chain of Input boxes bigerikt Excel Programming 3 August 12th 04 10:12 PM
Chain Printing Antonio Castro Excel Programming 1 August 12th 03 12:23 PM


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