View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Combine Worksheets: Works Well in Test Mode, Locks when running no

As expected, your code ran fine for me.

--
Regards,
Tom Ogilvy


"BEEJAY" wrote:


When stepping thru in test mode, the macro works fine.
When activated with Shortcut key, the macro stops at line indicated by .
I can't figure out why.
I'm sure there has to be a much better way to combine up to 11 ws, but I
don't seem to find what I need in all of Ron deBruin's samples.
Am I overlooking the one magic sample?

Sub Combine_M2M_Extracts()

ActiveWorkbook.SaveAs Filename:="C:\DATA\Master.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

Application.ScreenUpdating = False
' Application.EnableEvents = False
====================================
' Open/Activate # 1 File and Select Used Range
Workbooks.Open Filename:="C:\DATA\1.xls"
Windows("1.xls").Activate

Rows("1:1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy

' Activate Destination File, and Insert Rows
Windows("Master.xls").Activate
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Windows("1.xls").Activate

' Activate #1 File and Close
Windows("1.xls").Activate
ActiveWindow.Close
=======================================
In between ========== basically repeats up to 10 times