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!
Bookmarks