我想制作一个复制两张纸并将它们粘贴到新工作簿中的宏。
Sub Export_File()
Dim Wb3 As Workbook
Dim Wb4 As Workbook
Dim strSaveName As String
For Each wB In Application.Workbooks
If Left(wB.Name, 9) = "Master BO" Then
Set Wb3 = wB
Exit For
End If
Next
strSaveName = Worksheets("Communication").Range("a2").Value
' copy sheets to new workbook
Sheets(Array("Auswertung", "Communication")).Copy
ActiveWorkbook.SaveAs strSaveName
Set Wb4 = ThisWorkbook
End Sub
一切正常 - 但现在我希望宏删除新工作簿中两个工作表的第一行。
我想删除第一行的原因是因为我在复制的文件中有导航栏。
希望有人可以帮助我。
问候
答案 0 :(得分:1)
Sub Export_File()
Dim Wb3 As Workbook
Dim Wb4 As Workbook
Dim strSaveName As String
For Each wB In Application.Workbooks
If Left(wB.Name, 9) = "Master BO" Then
Set Wb3 = wB
Exit For
End If
Next
strSaveName = Worksheets("Communication").Range("a2").Value
' copy sheets to new workbook
Sheets(Array("Auswertung", "Communication")).Copy
ActiveWorkbook.Sheets("Auswertung").Rows(1).Delete
ActiveWorkbook.Sheets("Communication").Rows(1).Delete
ActiveWorkbook.SaveAs strSaveName
Set Wb4 = ThisWorkbook
End Sub