Design mode is turned on when macro opens the file

SNeaK930

New Member
Joined
Jun 26, 2012
Messages
5
Hello, Whenever i run a macro to merge multiple files into 1 it fails. The macro worked perfectly in the step by step mode and in excel 2003. Im currently Using 2010 and for some reason this started to happen.

I would really appriciate some help and thank you all in advance.

Below is the code:

Sub combinefinal()
'
' combinefile Macro
' Macro recorded 1/31/2011 by pb
'
' Keyboard Shortcut: Ctrl+Shift+N
'
Dim outputcells As Excel.Range

On Error GoTo err102:
Application.ScreenUpdating = False

FilesToOpen = Application.GetOpenFilename _
(filefilter:="microsoft excel files (*xls), *.xls", _
MultiSelect:=True, Title:="files to merge")

If TypeName(FilesToOpen) = "boolean" Then
MsgBox "no files were selected"
GoTo exithandler
End If

X = 1
While X <= UBound(FilesToOpen)
Workbooks.Open Filename:=FilesToOpen(X)
Sheets("Activity Summary").Select
Range("A1:I200").Select
Selection.copy
Windows("BANK ANALYSIS FY12.xlsm").Activate
Sheets("CAP CORP").Select


Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 2).Select
ActiveSheet.Paste
FilesToOpen = Application.GetOpenFilename _
(filefilter:="microsoft excel files (*xls), *.xls", _
MultiSelect:=True, Title:="files to merge")
'allows the macro to open up xls type files. if files change you can change them here

If TypeName(FilesToOpen) = "boolean" Then
MsgBox "no files were selected"
GoTo exithandler
End If

X = 1
While X <= UBound(FilesToOpen)
Workbooks.Open Filename:=FilesToOpen(X)
Sheets("Activity Summary").Select
Range("A1:I200").Select
Selection.copy
Windows("BANK ANALYSIS FY12.xlsm").Activate
Sheets("COLLECTION").Select

Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 2).Select
ActiveSheet.Paste

FilesToOpen = Application.GetOpenFilename _
(filefilter:="microsoft excel files (*xls), *.xls", _
MultiSelect:=True, Title:="files to merge")
'allows the macro to open up xls type files. if files change you can change them here

If TypeName(FilesToOpen) = "boolean" Then
MsgBox "no files were selected"
GoTo exithandler
End If

X = 1
While X <= UBound(FilesToOpen)
Workbooks.Open Filename:=FilesToOpen(X)
Sheets("Activity Summary").Select
Range("A1:I200").Select
Selection.copy
Windows("BANK ANALYSIS fy12.xlsm").Activate
Sheets("INS").Select


Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 2).Select
ActiveSheet.Paste

exithandler:
Application.ScreenUpdating = True
Exit Sub
err102:
MsgBox Err.Description
Resume exithandler

Wend
Wend
Wend
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Didn't seem to be any problem in xl2007.
 
Upvote 0

Forum statistics

Threads
1,203,064
Messages
6,053,320
Members
444,653
Latest member
Curdood

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top