请帮忙关闭一本工作簿,其中"喜欢"当打开下面的样品时使用?
Dim wb As Workbook
For Each wb In Application.Workbooks
If wb.Name Like "SHIPPING LIST*" Then wb.Activate
Next wb
Columns("A:I").Select
Selection.Copy
Windows("PRIORITIES TEMPLATE - SHIPPING LIST.xlsm").Activate
Sheets("xyz - abc").Select
Range("A1").Select
Sheets("xyz - abc").Paste
答案 0 :(得分:1)
试试这个: (摆脱无用和记忆贪婪"选择"和"激活")
Dim wb As Workbook
Dim WbName as String
For Each wb In Application.Workbooks
If wb.Name Like "SHIPPING LIST*" Then
wb.Sheets(1).Columns("A:I").Copy
Destination:=Workbooks("PRIORITIES TEMPLATE - SHIPPING LIST.xlsm").Sheets("xyz - abc").Range("A1")
wb.Close
Else
End if
Next wb
如果wb.Name Like "SHIPPING LIST*"
无法正常工作(从未在VBA中使用过它...),请使用Instr(1, wb.Name, "SHIPPING LIST")<>0 then