1个回答
展开全部
Sub 调取数据()
Dim Fo As Object, myName As String
Set Fo = Application.FileDialog(msoFileDialogFilePicker)
Fo.Title = "请选择您要复制数据的文件:"
If Fo.Show = True Then myName = Fo.SelectedItems(1)
If myName = "" Then
MsgBox "您取消了文件选择,所以本次处理未完成,将直接退出", vbOKOnly + vbInformation
Exit Sub
End If
Dim wb As Workbook
For Each wb In Workbooks
If wb.FullName = myName Then GoTo wbHasOpened
Next
Set wb = Workbooks.Open(myName)
wbHasOpened:
Dim a as Integer
a = InputBox("请输入")
Dim sh As Worksheet
For Each sh In wb.Sheets
If sh.Name = "VQS" Then
sh.Range("L107:T" & (107 + a * 10 -1)).Copy
Sheet1.[b3].PasteSpecial paste:=xlPasteValues
Exit For
End If
Next
MsgBox "处理完成!"
wb.Close True
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询