|
楼主 |
发表于 2013-2-13 11:15
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
增加账户出现 运行时错误 9 下标越界
Sub 拆分表()
Dim i%
Dim rng As Range
Dim s As String
Dim sht As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each sht In Sheets
If sht.Name <> "流水账" Then sht.Range("A5:p50000").ClearContents
Next
i = 5
s = Cells(i, "a").Value
Do While s <> ""
Set rng = Worksheets(s).Range("a65000").End(3).Offset(1, 0) Cells(i, "b").Resize(1, 15).Copy rng
i = i + 1
s = Cells(i, "a").Value
Loop
Application.DisplayAlerts = False
Application.ScreenUpdating = True
End Sub
|
|