View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Roger Govier Roger Govier is offline
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