|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
试了一下,很好用!谢谢
另外想问 一下,我的这1000多个表单里面,引用了类似于总表的这个工作表有8个,想问一下,怎么来修改这个VBA?
也就是说1-100引用了总表1,101-200引用了总表2.....
大谢!
8个总表名称分别改为10000,20000……80000,代码如下
Sub test()
Dim k1%, k2%, k3%, k4%, k5%, k6%, k7%, k8%, j$
For Each sht In Worksheets
j = sht.Name
i = j + 0
Select Case i
Case Is < 101
sht.Cells(2, 2) = Worksheets("10000").Cells(k1 + 1, 4)
k1 = k1 + 1
Case Is < 201
sht.Cells(2, 2) = Worksheets("20000").Cells(k2 + 1, 4)
k2 = k2 + 1
Case Is < 301
sht.Cells(2, 2) = Worksheets("30000").Cells(k3 + 1, 4)
k3 = k3 + 1
Case Is < 401
sht.Cells(2, 2) = Worksheets("40000").Cells(k4 + 1, 4)
k4 = k4 + 1
Case Is < 501
sht.Cells(2, 2) = Worksheets("50000").Cells(k4 + 1, 4)
k5 = k5 + 1
Case Is < 601
sht.Cells(2, 2) = Worksheets("60000").Cells(k3 + 1, 4)
k6 = k6 + 1
Case Is < 701
sht.Cells(2, 2) = Worksheets("70000").Cells(k4 + 1, 4)
k7 = k7 + 1
Case Is < 801
sht.Cells(2, 2) = Worksheets("80000").Cells(k4 + 1, 4)
k8 = k8 + 1
End Select
Next
End Sub |
|