vba代码中,提示下标越界,哪里越界,如何解决?
Sub拆分到工作簿()DimwkAsWorkbook,ss$,k%Application.DisplayAlerts=FalseForEachshtInWorkbooks...
Sub 拆分到工作簿()
Dim wk As Workbook, ss$, k%
Application.DisplayAlerts = False
For Each sht In Workbooks("122").Sheets
Set wk = Workbooks.Add
k = k + 1
Workbooks(1).Sheets(k).Copy Workbooks(2).Sheets(1)
ss = ThisWorkbook.Path & "\" & sht.Name & ".xlsx"
wk.SaveAs ss
wk.Close
Next
Application.DisplayAlerts = True
MsgBox "拆分工作簿完成!"
End Sub 展开
Dim wk As Workbook, ss$, k%
Application.DisplayAlerts = False
For Each sht In Workbooks("122").Sheets
Set wk = Workbooks.Add
k = k + 1
Workbooks(1).Sheets(k).Copy Workbooks(2).Sheets(1)
ss = ThisWorkbook.Path & "\" & sht.Name & ".xlsx"
wk.SaveAs ss
wk.Close
Next
Application.DisplayAlerts = True
MsgBox "拆分工作簿完成!"
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询