Godders199
Active Member
- Joined
- Mar 2, 2017
- Messages
- 313
- Office Version
- 2013
Hello, I have the following code which selects data from the summary tab, copies it, opens up a template workbook, then runs Marco3 in that book.
The last action in Marco3 is to close the template workbook
Once that completes I want to call a marco in the original summary workbook, but I cant get the code to continue after marco 3 completes. The code below I have put in an if and end if statement, but that does not help.
Msgbox “it works” is purely there to show me something happens after marco 3 is complete and the template workbook shut
I cant get this msgbox to appear.
If I f8 through the code it just stops on End if.
Can someone tell me what I need to change to effectively add more code where the msgbox is so it will run.
I have removed the full file addresses for this question incase anyone things that is the problem.
Application.CutCopyMode = False
Application.ScreenUpdating = False
' auto Macro
'Dim XM as long
Sheets("summary").Select
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilter.ShowAllData
Cells.Select
ActiveSheet.Range("A:af").AutoFilter field:=26, Criteria1:="<>"
If Application.CountIf([Ab:Ab], "<>") > 1 Then
Range("y1:aa1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
ChDir _
"S:\BAL Templates"
Workbooks.Open Filename:= _
"S:\FileCheck Template.xls"
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("2:2").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("A2").Select
Application.Run "'S:Macro3"
End If
MsgBox "it works"
Application.ScreenUpdating = True
Application.CutCopyMode = True
The last action in Marco3 is to close the template workbook
Once that completes I want to call a marco in the original summary workbook, but I cant get the code to continue after marco 3 completes. The code below I have put in an if and end if statement, but that does not help.
Msgbox “it works” is purely there to show me something happens after marco 3 is complete and the template workbook shut
I cant get this msgbox to appear.
If I f8 through the code it just stops on End if.
Can someone tell me what I need to change to effectively add more code where the msgbox is so it will run.
I have removed the full file addresses for this question incase anyone things that is the problem.
Application.CutCopyMode = False
Application.ScreenUpdating = False
' auto Macro
'Dim XM as long
Sheets("summary").Select
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilter.ShowAllData
Cells.Select
ActiveSheet.Range("A:af").AutoFilter field:=26, Criteria1:="<>"
If Application.CountIf([Ab:Ab], "<>") > 1 Then
Range("y1:aa1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
ChDir _
"S:\BAL Templates"
Workbooks.Open Filename:= _
"S:\FileCheck Template.xls"
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("2:2").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("A2").Select
Application.Run "'S:Macro3"
End If
MsgBox "it works"
Application.ScreenUpdating = True
Application.CutCopyMode = True