jalrs
Active Member
- Joined
- Apr 6, 2022
- Messages
- 300
- Office Version
- 365
- Platform
- Windows
Hello guys,
What im looking for here is to save sheets into different workbooks, where workbook name = sheet name. After doing my research i came to this bit of code, but, unfortunately it only copies the first sheet where the name is <> than "Readme" as code shows.
My code:
Sub CriarWBs()
totalsheets = ThisWorkbook.Sheets.Count
For i = 1 To totalsheets
strsheetname = ThisWorkbook.Sheets(i).Name
If strsheetname <> "Readme" Then
Sheets(strsheetname).Select
Sheets(strsheetname).Copy
ActiveWorkbook.SaveAs Filename:="C:\Users\joafrodrigue\Desktop\teste\Difusao\" & strsheetname & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
End If
Next
End Sub
Thank you very much guys!
What im looking for here is to save sheets into different workbooks, where workbook name = sheet name. After doing my research i came to this bit of code, but, unfortunately it only copies the first sheet where the name is <> than "Readme" as code shows.
My code:
Sub CriarWBs()
totalsheets = ThisWorkbook.Sheets.Count
For i = 1 To totalsheets
strsheetname = ThisWorkbook.Sheets(i).Name
If strsheetname <> "Readme" Then
Sheets(strsheetname).Select
Sheets(strsheetname).Copy
ActiveWorkbook.SaveAs Filename:="C:\Users\joafrodrigue\Desktop\teste\Difusao\" & strsheetname & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
End If
Next
End Sub
Thank you very much guys!