|
本帖最后由 mjzxlmg 于 2012-3-13 22:56 编辑
cker163 发表于 2012-3-13 22:27
感谢二、三楼大大。例子表我已经上传到一楼,不好意思,希望老大们帮助利用VBA的方法体现出来,复制粘贴太麻 ...
[code=vb]Option Explicit
Sub test()
Dim arr, brr(1 To 100000, 1 To 9), i&, j&, m&, sht As Worksheet
For Each sht In Worksheets
If sht.Name <> "汇总" Then
arr = sht.[a1].CurrentRegion.Value
For i = 1 To UBound(arr)
m = m + 1
For j = 1 To UBound(arr, 2)
If j <> 1 And j <> 2 Then
brr(m, j) = arr(i, j)
Else
brr(m, j) = "'" & arr(i, j)
End If
Next
Next
End If
Next
Sheets("汇总").UsedRange.ClearContents
Sheets("汇总").[a1].Resize(m, 9).Value = brr
End Sub
[/code]
测试附件:
测试表.rar
(307.95 KB, 下载次数: 629)
|
|