Jediantman
New Member
This is my first fully fledged macro that I'm creating and so I'm still very much a novice. Thanks to some help through this message board I've created my code for compiling 10 individual workbooks into one 'Master', by copying and pasting the data to specific locations in the master.
All works fine when I run the macro step by step (F8) and it populates everything I need but when I return to the workbook to run it from the shortcut it first of all told me that it "Can't execute code in break mode" but, since correcting one little error I noticed, it now opens the first spreadsheet and does nothing further.
The code I currently have is:
'Open Ann's Tracker, select S5 cells and copy
Workbooks.Open Filename:= _
"T:FilepathAut2012 Tracker Ann.xlsx" _
, ReadOnly:=True, Notify:=False
Sheets("Section 5").Select
Range("A23:CS250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("Section5Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S5 - SM tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S5 Cat. - SM").Select
Range("A23:CQ250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("S5 Cat - SM Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S5 - NTI tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S5 Cat - NTI").Select
Range("A23:CQ250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("S5 Cat - NTI Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S8 tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S8 All Types").Select
Range("A23:BT250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("S8 All Types Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S162 Standard tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S162a - Ind 1st,Std, LT").Select
Range("A23:BM250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("s162a Std Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
r />ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S162 Progress Monitoring tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S162a Prog Mon").Select
Range("A23:BN250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("s162a Prog Mon Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S162 Other tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S162a Other").Select
Range("A23:BD250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("s162a Other Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select Academy Registration tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("Academy Registration").Select
Range("A23:CS250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("Academy Reg Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Close Ann's Tracker
Windows("Aut2012 Tracker Ann.xlsx").Activate
Application.DisplayAlerts = False
ActiveWindow.Close
' Open Ant's Tracker, select cells and copy
Workbooks.Open Filename:= _
"T:FilepathAut2012 Tracker Ant.xlsx" _
, ReadOnly:=True, Notify:=False
Everything from this point just repeats for each of the remaining workbooks but the above section for "Ant's Tracker" is currently highlighted in red (presumably to tell me something is wrong) but I can't see what is causing that problem. When the shortcut runs it stops as soon as it has opened the first workbook.
Any and all help is very much appreciated and I look forward to your responses
Thanks Ant.
All works fine when I run the macro step by step (F8) and it populates everything I need but when I return to the workbook to run it from the shortcut it first of all told me that it "Can't execute code in break mode" but, since correcting one little error I noticed, it now opens the first spreadsheet and does nothing further.
The code I currently have is:
'Open Ann's Tracker, select S5 cells and copy
Workbooks.Open Filename:= _
"T:FilepathAut2012 Tracker Ann.xlsx" _
, ReadOnly:=True, Notify:=False
Sheets("Section 5").Select
Range("A23:CS250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("Section5Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S5 - SM tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S5 Cat. - SM").Select
Range("A23:CQ250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("S5 Cat - SM Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S5 - NTI tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S5 Cat - NTI").Select
Range("A23:CQ250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("S5 Cat - NTI Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S8 tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S8 All Types").Select
Range("A23:BT250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("S8 All Types Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S162 Standard tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S162a - Ind 1st,Std, LT").Select
Range("A23:BM250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("s162a Std Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
r />ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S162 Progress Monitoring tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S162a Prog Mon").Select
Range("A23:BN250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("s162a Prog Mon Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select S162 Other tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("S162a Other").Select
Range("A23:BD250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("s162a Other Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Go back to Ann's Tracker and select Academy Registration tab, select cells and copy
Windows("Aut2012 Tracker Ann.xlsx").Activate
Sheets("Academy Registration").Select
Range("A23:CS250").Select
Selection.Copy
Windows("Datamastermacro.xlsm").Activate
Sheets("Academy Reg Master").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=213
Range("A251").Select
'Close Ann's Tracker
Windows("Aut2012 Tracker Ann.xlsx").Activate
Application.DisplayAlerts = False
ActiveWindow.Close
' Open Ant's Tracker, select cells and copy
Workbooks.Open Filename:= _
"T:FilepathAut2012 Tracker Ant.xlsx" _
, ReadOnly:=True, Notify:=False
Everything from this point just repeats for each of the remaining workbooks but the above section for "Ant's Tracker" is currently highlighted in red (presumably to tell me something is wrong) but I can't see what is causing that problem. When the shortcut runs it stops as soon as it has opened the first workbook.
Any and all help is very much appreciated and I look forward to your responses
Thanks Ant.