excel中 Set s = wb.Worksheets("保存名称B3单元格所在的sheet名称")下标越界,怎么修改?
Sub另存为()DimwbAsWorkbookDimsAsWorksheetForEachwbInWorkbooksIfwb.Name<>"A.xlsx"ThenSets...
Sub 另存为()
Dim wb As Workbook
Dim s As Worksheet
For Each wb In Workbooks
If wb.Name <> "A.xlsx" Then
Set s = wb.Worksheets("保存名称B3单元格所在的sheet名称")
wb.SaveAs "C:\Users\Administrator\Desktop\新建文件夹 (2)" & s.Cells(4, 2) & ".xlsx"
wb.Close True
End If
Next
End Sub 展开
Dim wb As Workbook
Dim s As Worksheet
For Each wb In Workbooks
If wb.Name <> "A.xlsx" Then
Set s = wb.Worksheets("保存名称B3单元格所在的sheet名称")
wb.SaveAs "C:\Users\Administrator\Desktop\新建文件夹 (2)" & s.Cells(4, 2) & ".xlsx"
wb.Close True
End If
Next
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询