|
发表于 2024-10-13 12:16
来自手机
|
显示全部楼层
Sub 存为新表_Click()
Dim sht1 As Worksheet, yn As Long
yn = VBA.MsgBox("", 36)
Set sht1 = ActiveSheet '指定表格
Application.CutCopyMode = False
If yn = 6 Then
sht1.Cells.Copy '复制全部
Dim sht As Worksheet
Set sht = Worksheets.Add '添加表格
sht.Paste '粘贴全部
sht.Cells(1, 1).Select
ElseIf yn = 7 Then
Dim wk As Workbook, sht2 As Worksheet
Set wk = Workbooks.Add
Set sht2 = wk.ActiveSheet
sht1.Cells.Copy
sht2.Paste
sht2.Cells(1, 1).Select
'''wk.Close SaveChange:=True '关闭保存
Else
Exit Sub
End If
Set sht = Nothing
Set sht1 = Nothing
Set sht2 = Nothing
Set wk = Nothing
End Sub |
评分
-
1
查看全部评分
-
|