|
Sub 导入()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set ss = ThisWorkbook
For Each sh In Sheets
If sh.Index > 1 Then
sh.Delete
End If
Next sh
Application.DisplayAlerts = True
lj = ThisWorkbook.Path & "\"
f = Dir(lj & "*.xls*")
Do While f <> ""
If f <> ThisWorkbook.Name Then
Set wb = Workbooks.Open(lj & f, 0)
mc = wb.Worksheets("Cover").[b11]
For Each sht In wb.Worksheets(Array("F01-资产负债表", "F02-利润表", "F03-现金流量表"))
sht.Copy after:=ss.Worksheets(ss.Worksheets.Count)
With ss.Worksheets(ss.Worksheets.Count)
.Name = mc & Split(sht.Name, "-")(1)
'.UsedRange.Value = .UsedRange.Value''目前工作表有保护,这句代码不能运行,暂时注释掉
End With
Next sht
wb.Close False
End If
f = Dir
Loop
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub |
|