Consolidate Multiple Books (Protected Sheet)

Dnyan

Board Regular
Joined
Mar 25, 2010
Messages
90
Hi,

I am using below code for consolidate multiple workbook, however I want to consolidate data from Sheet1 which is protected. so is it possible to consolidate data from Protected sheet.

HTML:
Option ExplicitDim fsoMain As New FileSystemObjectDim myFldr As FolderDim myWB As Workbook, tempWB As WorkbookDim fl As File
Sub getFiles()
    'Always Change Below path as required, this will consolidate data from your folder of below given path   Set myFldr = fsoMain.GetFolder("S:\Mumbai Shared\Mumbai Sales and service\Process\Mumbai Motor paper\Others\Login Tracker")   Set myWB = ActiveWorkbook   For Each fl In myFldr.Files      If Right(fl.Name, 4) = "xlsm" Then  '2007 format and above                  Set tempWB = Workbooks.Open(fl.Path) 'opening the files one by one         With Sheets("Sheet1")                     .Range("A2").CurrentRegion.Offset(1).SpecialCells(xlVisible).Copy myWB.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1)         End With         tempWB.Close False      End If   Next fl   Application.ScreenUpdating = TrueEnd Sub

The error is coming while running the code.(Run-time error '1004')
Kindly suggest
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,216,084
Messages
6,128,724
Members
449,465
Latest member
TAKLAM

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