这个概念非常基本,请创建摘要表并开始填写数据,它确实可以在第一张表上工作(即使它花费了不合理的时间),但随后它会抛出错误&# 34;默认范围不适用"在这一行:
If Len(c) <> 0 And InStr(1, c.Value, "C-") Then _
我不确定从一张纸到另一张纸会有什么变化,因为它们具有完全相同的结构。
'Add a worksheet with the name "Summary"
Set DestSh = ActiveWorkbook.Worksheets.Add
DestSh.Name = "Summary"
DestSh.Range("A1").Value = "Account"
DestSh.Range("B1").Value = "Exchange"
DestSh.Range("C1").Value = "Quarter"
DestSh.Range("D1").Value = "Year"
Set destRng = DestSh.Range("A2")
'Loop through all worksheets and copy the data to the
'summary worksheet.
For Each xSheet In ActiveWorkbook.Worksheets
If InStr(1, xSheet.Name, "ACCOUNT") And xSheet.Range("B1") <> "No Summary Available" Then _
Set copyRng = xSheet.Cells
For Each c In copyRng.SpecialCells(xlCellTypeVisible)
If Len(c) <> 0 And InStr(1, c.Value, "C-") Then _
'Copy to destination Range
c.Copy destRng
'Set destination
Set destRng = destRng.Offset(1, 0)
End If
Next c
End If
Next xSheet