因此,我试图完成一个宏,该宏选择具有相似名称的所有工作表,并在工作簿中的特定工作表之前移动它们。用户可以使用这些名称添加尽可能多的页面,所以我不能只使用数组函数来移动它们。这是我到目前为止有:在工作簿中移动具有相似名称的页面
Sub Copier()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim x As Integer
x = InputBox("Enter Number of Additional Features")
For numtimes = 1 To x
ActiveWorkbook.Sheets(Array("Data Collection", "Findings", "Visual Findings")).Copy _
Before:=ActiveWorkbook.Sheets("Final Results")
'Allows user to create as many pages as necessary
Dim ws As Worksheet, flg As Boolean
For Each ws In Worksheets
If (ws.Name) Like "*Data Collection*" Then
ws.Select Not flg
flg = True
End If
Next
'Selects all sheets for "Data Collection"
'Now I need to move all of those selected before a certain sheet at the
beginning of the workbook
'I cant seperate the copy functions because some formulas from data collection have to carry
over to the other copied sheets
'Sheet2.Activate
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
你如何定义“相似的名字”? “发现”类似于“视觉发现”?也许最好说明你想在所有其他表之后的某个页面(“最终结果”?)*? – BruceWayne
用户创建的数据收集页面需要靠近报表的开头。在创建页面之前和之后还有其他页面与此无关。我试图将所有的数据收集页面都引导到开头,这样我的用户就可以填写它们,而无需查看整个报告。 –