|
楼主 |
发表于 2011-4-1 06:49
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
首先感谢 yaojil 的回答
我想问一下
Sub feiqu()
Dim arr, wb As Workbook, mp$, mf$
Application.DisplayAlerts = False
Application.ScreenUpdating = False
mp = ThisWorkbook.Path & "\"
mf = Dir(mp & "*.xls")
R = 2
While mf <> ""
If mf <> ThisWorkbook.Name Then
Set wb = GetObject(mp & mf) 有的机器执行到这里时显示 类型不匹配? 有的机器没事 请问是什么原因?
With wb.Sheets(1)
arr = .Range("b10:d10")
Cells(R, 2).Resize(UBound(arr), UBound(arr, 2)) = arr
wb.Close False
End With
R = R + UBound(arr)
End If
mf = Dir
Wend
For i = 2 To R - UBound(arr)
Cells(i, 1) = i - 1
Next
Set wb = Nothing
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub |
|