这是我想要更改的屏幕截图Screenshot1。在图片中,###需要替换为
N01
N02
N10等
这将根据需要指定,因为它不在订单中(可以是N01,N05,N12等),其余部分需要复制粘贴。这需要在新的工作表中生成。
新生成的工作表将填充N01,N02等所有实例。所需结果的屏幕截图在Screenshot2
下面给出答案 0 :(得分:0)
'根据行A2:T2中提供的主数据创建数据。在“Replicated_Data”工作表中创建1-49个实例,并清除“Master_Data”表单中的内容
Private Sub CommandButton2_Click()
Id name seq MonthFrom MonthTo Week Day
1 Tom Smith 1 3 6 3 15
1 Tom Smith 2 7 9 NULL 25
2 Bruce Lee 1 NULL NULL NULL 12
3 Seamus O’Leary 1 NULL NULL 4 NULL
3 Seamus O’Leary 2 5 6 NULL NULL
4 Jonathan Stewart 1 NULL NULL 1 5
5 Benjamin Franklin 1 NULL NULL NULL 19
End Sub
'将数据从“Replicated_Data”表复制到“Test”表,并清除“Replicated_Data”表中的内容。
Private Sub CommandButton1_Click()
ActiveCell.FormulaR1C1 = "B01"
Range("A2").Select
SELECTION.AutoFill Destination:=Range("A2:A50"), Type:=xlFillDefault
Range("A2:A50").Select
ActiveWindow.SmallScroll Down:=-55
Range("B2").Select
SELECTION.AutoFill Destination:=Range("B2:B50"), Type:=xlFillDefault
Range("B2:B50").Select
Range("A49").Select
SELECTION.AutoFill Destination:=Range("A49:A50"), Type:=xlFillDefault
Range("A49:A50").Select
ActiveWindow.SmallScroll Down:=-60
Range("D2").Select
SELECTION.AutoFill Destination:=Range("D2:D50"), Type:=xlFillDefault
Range("D2:D50").Select
ActiveWindow.SmallScroll Down:=-55
Range("E2").Select
SELECTION.AutoFill Destination:=Range("E2:E50"), Type:=xlFillDefault
Range("E2:E50").Select
ActiveWindow.SmallScroll Down:=-45
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
Range("M2").Select
SELECTION.AutoFill Destination:=Range("M2:M50"), Type:=xlFillDefault
Range("M2:M50").Select
ActiveWindow.SmallScroll Down:=-50
Range("R2").Select
SELECTION.AutoFill Destination:=Range("R2:R50"), Type:=xlFillDefault
Range("R2:R50").Select
ActiveWindow.SmallScroll Down:=-55
Range("S2:T2").Select
SELECTION.Copy
Range("S3:T50").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-65
Range("N2:Q2").Select
Application.CutCopyMode = False
SELECTION.Copy
Range("N3:Q50").Select
ActiveSheet.Paste
Range("J40").Select
ActiveWindow.SmallScroll Down:=-50
Range("F2:L2").Select
Application.CutCopyMode = False
SELECTION.Copy
Range("F3:L50").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=-70
Range("C2").Select
Application.CutCopyMode = False
SELECTION.Copy
Range("C3:C50").Select
ActiveSheet.Paste
Range("C52").Select
ActiveWindow.SmallScroll Down:=-75
Range("B2:T50").Select
Application.CutCopyMode = False
SELECTION.Copy
Sheets("Replicated_Data").Select
ActiveWindow.SmallScroll Down:=-40
ActiveSheet.Paste
SELECTION.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A2:Z1000").ClearContents
End Sub