【发布时间】:2016-05-04 06:21:52
【问题描述】:
我想制作一个具有不同宏按钮的工作表 此工作表名为 Buttons。此工作表中的宏按钮链接到应在不同工作表上运行的宏。我试图为工作表 1 制作一个宏按钮。库存和需求:
Sub NeuerTag()
'Abfrage ob der Tag eingefügt werden soll, No = QUIT'
If MsgBox("Möchtest du die Tabelle vorbereiten?", vbYesNo) = vbNo Then Exit Sub
'Copies the last three coloumns of the Worksheet 1. Stock & Demand'
With Sheets("1. Stock & Demand")
Lastcol = .Cells(1, Columns.Count).End(xlToLeft).Column
Columns(Lastcol - 1).Resize(, 1).Select
Selection.Copy
'Selects the first empty cell in 1. Stock & Demand and pastes'
Sheets("1. Stock & Demand").Range("F3:ZZ3").End(xlToRight).Offset(-2, 1).Paste
'Pastes the Today()'
Sheets("1. Stock & Demand").Range("F3:ZZ3").End(xlToRight).Offset(-1, 0).Select
Selection.Value = Date
'Paste Special - Values'
With Sheets("1. Stock & Demand")
Lastcol = .Cells(1, Columns.Count).End(xlToLeft).Column
Columns(Lastcol - 3).Resize(, 1).PasteSpecial Paste:=xlPasteValues
End With
End With
End Sub
现在我有一个问题。每次我制作一个宏按钮并让它运行时,它只会在工作表 Buttons 中完成他的工作,而不是在我希望它工作的工作表中。
我不得不说我不太擅长编码,所以请像我五岁一样向我解释一下;-)。
【问题讨论】: