vbachanger
New Member
- Joined
- Sep 15, 2021
- Messages
- 20
- Office Version
- 365
- Platform
- Windows
Hi, my workbook cointains 5 worksheets of which I need to export sheet1, sheet2 and sheet3 in seperate workbooks.
Need to copy format, without formulas. The code below copies the user form button into the new workbook. How to prevent that?
Workbooks should have the same name as the original file and the sheet name. How to change the code to save the file with the name of the sheet without defining the sheetname in the code?
THX
Need to copy format, without formulas. The code below copies the user form button into the new workbook. How to prevent that?
Workbooks should have the same name as the original file and the sheet name. How to change the code to save the file with the name of the sheet without defining the sheetname in the code?
VBA Code:
Sub sheet1_2_3 ()
strFile = ThisWorkbook.Fullname
strFile = Left(strFile, InStrRev(strFile, ".")-1) & "_sheet1.xlsx
Sheets("sheet1").Copy
With ActiveSheet.UsedRange
.Value = .Value
End With
ActiveWorkbook.SaveAs Filename:=strFile, FileFormat:=xlOpenXMLWorkbook, local:=True
End Sub
THX