+ Reply to Thread
Results 1 to 3 of 3

78 read only files that need to be pasted to 78 sheets in one master file.

  1. #1
    Registered User
    Join Date
    01-06-2013
    Location
    Chicago, United States
    MS-Off Ver
    Excel 2010
    Posts
    0

    78 read only files that need to be pasted to 78 sheets in one master file.

    Hello,

    I'm have a program that opens files as read only and names each file differently. I'm trying to write code that will copy sheet on and then paste into a master file, next sheet and paste. My problem is, when I Dim workbookname1, sheetname as string, I paste into the master file, toggle back to workbookname1 and close without saving, I can't get my code to toggle to the next read only. I have to manually click on the next read only file and run code for each sheet. I open 76 read only files at one time. I want to loop through all 76 files closing each after pasting, and file save my master.

    Sub Toogletonextworkbookandpaste()
    Dim Dim WorkbookName1, SheetName As String
    WorkbookName1 = ActiveWorkbook.Name
    Windows(WorkbookName1).Activate
    Cells.Select
    Selection.Copy
    Windows("Fresh P&L.xlsm").Activate
    Sheets("Sheet1").Select (In a loop, I use next sheet)
    Selection.PasteSpecial Paste:=xlPasteValues
    Windows(WorkbookName1).Activate
    Application.DisplayAlerts = False
    ActiveWorkbook.Close
    Application.DisplayAlerts = True

    I've wasted a full day trying to figure this out. Any suggestions or help is deeply appreciated!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: 78 read only files that need to be pasted to 78 sheets in one master file.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: 78 read only files that need to be pasted to 78 sheets in one master file.

    Hi, patel45,

    according to Forum Rules:
    7. Don't ignore requests by Administrators, Moderators, or senior members of the forum. If you are unclear about their request or instructions, then send a private message to them asking for help. Do not post a reply in a thread where such a request (e.g., title change, code tags) is pending.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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