|
Private Sub CommandButton1_Click()
Dim MyArr, MyPath As String, MyFullName As String
MyArr = Sheet7.Range("A1").CurrentRegion
If UBound(MyArr) < 2 Then Exit Sub
Application.ScreenUpdating = False
MyPath = ThisWorkbook.Path
For i = 2 To UBound(MyArr)
If Len(MyArr(i, 2)) > 0 Then
MyFullName = MyPath & "\" & MyArr(i, 1) & ".xlsx"
Sheets(MyArr(i, 1)).Copy
ActiveWorkbook.SaveAs Filename:=MyFullName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Close
End If
Next i
Application.ScreenUpdating = True
End Sub
这段代码可以导出单个的工作表,现在想改成导出一个工作簿,并且去掉公式,改了几次老出错,麻烦各位大神给修改下,谢谢
|
|