This is the code I use . First I copyt the content which I want. And then run the macro below, but it pops out a error that class worksheet invalid paste method. Why is that?
Sub saveNewFile()
'
' saveNewFile 宏
'
'
Dim ws As Worksheet
With ThisWorkbook
Set ws = .Sheets.Add(After:=.Sheets(.Sheets.Count))
ws.Name = "TodaySheet"
End With
ActiveSheet.Paste Destination:=Sheets("TodaySheet").Range("A1:R100")
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveSheet.Select
ActiveSheet.Move
Sheets("TodaySheet").Columns.AutoFit
ArrangeDate = DateAdd("d", 1, Date)
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Administrator\Desktop\" & ArrangeDate & "发货.xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
Bookmarks