+ Reply to Thread
Results 1 to 2 of 2

Unprotect, unhide sheets in multiple excel files to then append data

  1. #1
    Registered User
    Join Date
    01-17-2022
    Location
    Australia
    MS-Off Ver
    MS Office 365
    Posts
    1

    Question Unprotect, unhide sheets in multiple excel files to then append data

    Hi all,

    I have a weekly task that involves collating 40+ excel files extracting data and appending into a master file. This data is captured in a hidden sheet where I need to first unprotect the workbook before I can unhide the table.

    I've tried to record a macro where I open the first file in the folder, unprotect, select and copy out the data. But I get different errors when I run it depending on which excel file I'm in. I think the recorded macro thinks I'm running from the protected workbook.


    Sub Test5()
    '
    ' Test5 Macro
    '

    '
    ActiveWorkbook.Unprotect
    Sheets("Form").Select
    Sheets("DataExtract").Visible = True
    Range("A2:I15").Select
    Selection.Copy
    Windows("Append File.xlsx").Activate
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("A16").Select
    End Sub



    I'd like to be able to loop this until all files in the folder have been opened and data extracted.

    Any help would be greatly appreciated.


    Cheers,

    Kal

  2. #2
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,360

    Re: Unprotect, unhide sheets in multiple excel files to then append data

    Maybe something like the below, is the range to be copied always the same size?

    Please Login or Register  to view this content.
    Hope this helps

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Append new data from multiple sheets to another sheet.
    By unlimitedz3r0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-09-2020, 06:27 PM
  2. [SOLVED] VBA code to protect/unprotect workbook in order to hide/unhide sheets with toggle button
    By brettosmith in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-15-2018, 08:01 PM
  3. Append Multiple XML Files to a table in Excel
    By pritchard.ev in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2016, 07:28 AM
  4. Append data from multiple excel files with respective file name
    By vijay20cbe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2014, 12:07 PM
  5. Replies: 0
    Last Post: 11-27-2012, 01:43 PM
  6. [SOLVED] Append Data to Multiple Files based upon Criteria
    By Topo in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-28-2012, 02:14 PM
  7. Append data in multiple sheets into one sheet
    By excel_vb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-22-2012, 10:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1