Já Vám rozumím Elnino, ale kam to mám zakomponovat? Když používám tento kód?
------------------------------------------------------------------------------
Sub akce_tydne_export_new_final()
ThisWorkbook.Worksheets("List 3").Copy
With ActiveWorkbook
With .Worksheets(1).UsedRange
.Copy
.PasteSpecial Paste:=xlPasteValues
R = .Parent.Cells(Rows.Count, "A").End(xlUp).Row
.Resize(.Rows.Count - R + 1).Offset(R, 0).EntireRow.Delete Shift:=xlUp
End With
Application.DisplayAlerts = False
.SaveAs "C:\Users\DELL i7\Desktop\NÁZEV.xlsx", xlOpenXMLWorkbook
Application.DisplayAlerts = True
.Close False
End With
End Sub
-----------------------------------------------------------------------
Když to udělám takto, nefunguje to.
Sub akce_tydne_export_new_final()
ThisWorkbook.Worksheets("List 3").Copy
With ActiveWorkbook
With .Worksheets(1).UsedRange
.Copy
.PasteSpecial Paste:=xlPasteValues
R = .Parent.Cells(Rows.Count, "A").End(xlUp).Row
.Resize(.Rows.Count - R + 1).Offset(R, 0).EntireRow.Delete Shift:=xlUp
ActiveWorkbook.Worksheets(List 3).Buttons(Array("Button 1", "Button 2")).Delete
End With
Application.DisplayAlerts = False
.SaveAs "C:\Users\DELL i7\Desktop\NÁZEV.xlsx", xlOpenXMLWorkbook
Application.DisplayAlerts = True
.Close False
End With
End Sub
Tento kód mi to vyexportuje perfektně, akorát, že tam zůstanou tlačítka.
citovat