|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
请各位老师帮忙,看看这个模块哪里出错了?谢谢
- Sub Macro1()
- Dim MyPath$, MyName$
- Dim target As Workbook
- Dim Source As Workbook
- Dim name1 As String
- Dim x As Integer
- Dim y As Integer
- Application.ScreenUpdating = False
-
- MyPath = "D:\工作文档\学习资料\excel表格\2018 实测"
- MyName = Dir(MyPath & "*.xls")
-
- name1 = "D:\工作文档\学习资料\excel表格\2018 实测\hisdatatest.xlsx"
- Set target = Workbooks.Open(name1)
-
- Do While MyName <> ""
- Set Source = Workbooks.Open(MyPath & MyName)
-
- Call hisdata
- Source.Sheets("sheet3").Range("a1", Range("a1").End(xlDown).Offset(1, 3)).Copy
-
-
- target.Sheets(3).Activate
- x = target.Sheets("sheet3").Range("A65536").End(xlUp).Row
-
- For i = 1 To x + 1
- If target.Sheets("sheet3").Range("a" & i) = "" Then
- y = i
- End If
- Next
-
- 'Application.Goto Sheets(1).Range("A1")
- target.Sheets("sheet3").Range("a" & y).Select
- Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
- :=False, Transpose:=False
- target.Close False
- Source.Close True
- MyName = Dir
- Loop
- Application.ScreenUpdating = True
- MsgBox "ok"
- End Sub
复制代码
|
|