我需要一个代码来处理用户表单。代码需要复制sheet1,根据userform中的两个文本框命名

I need a code to work with a userform. The code needs to copy sheet1 and name it according to two text boxes in the userform

用户窗体有两个文本框,一个用于输入当前月份,另一个用于输入年份(如果能预先输入年份就更好了)。它还有两个按钮,一个用于创建新的 sheet,另一个用于取消。我想要一个代码来复制 Sheet1 并根据用户窗体中的两个文本框命名它。 IE:2019 年 5 月。该代码必须复制存在于 sheet1 中的四个命令按钮,以及按钮位置、按钮代码和其中包含信息的所有单元格。这四个命令按钮是新建条目、更新条目、删除条目和新建日志。 (“新建日志”命令按钮将包含我要求的代码)。创建新的 sheet 后,命令按钮必须适用于新的 sheet。 Image of Sheet1 With UserForm Opened

您可以像这样使用隐藏模板sheet.Something:

application.screenupdating = false

with thisworkbook.sheets("template")
    .visible = true
    .copy after:=thisworkbook.sheets(thisworkbook.sheets.count)
    .visible=false
end with

thisworkbook.sheets(thisworkbook.sheets.count).name = SheetName

application.screenupdating = true