Hi,
I have the code below which creates a file from every worksheet in my workbook. It works fine however it doesn't preserve any cell merging when it creates the new files - the merging is lost in the new files. Is there some code that I can add into this routine so any cell merging is preserved?
Many thanks,
I have the code below which creates a file from every worksheet in my workbook. It works fine however it doesn't preserve any cell merging when it creates the new files - the merging is lost in the new files. Is there some code that I can add into this routine so any cell merging is preserved?
Many thanks,
Code:
MyPath = ThisWorkbook.Path
For Each sht In ThisWorkbook.Sheets
sht.Copy
ActiveSheet.Cells.Copy
ActiveSheet.Cells.PasteSpecial Paste:=xlPasteValues
ActiveSheet.Cells.PasteSpecial Paste:=xlPasteFormats
ActiveWorkbook.SaveAs _
Filename:=MyPath & "\" & sht.Name & ".xlsx"
ActiveWorkbook.Close savechanges:=False
Next sht
Last edited: