|
tina_sun 发表于 2012-12-29 16:20
非常感谢!
还有一个问题,现在读出来的sheet名称跟源文件中的一样,有很多重复的,现在我想加一个操作, ... - Private Sub CommandButton1_Click()
- Dim wb As Object, sht As Worksheet, wbn$
- Application.ScreenUpdating = False
- Set sht = ActiveSheet
- MyPath = ThisWorkbook.Path & ""
- MyFile = Dir(MyPath & "*.xls")
- ChDrive Split(MyPath, ":")(0)
- ChDir MyPath
- Do While MyFile <> ""
- If MyFile <> ThisWorkbook.Name Then
- wbn = Replace(MyFile, ".xls", "")
- Set wb = GetObject(MyFile)
- For Each sh In wb.Sheets
- If sh.Name <> "说明" Then
- sh.Copy before:=sht
- ActiveSheet.Name = wbn & sh.Name
- End If
- Next
- wb.Close False
- End If
- MyFile = Dir()
- Loop
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|