|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下。。。
Sub 按钮1_Click()
Application.ScreenUpdating = False
n = Application.InputBox("请输入提取的工作簿序号:", "输入数字:", 1, , , , , 1)
Set wb = ThisWorkbook
p = wb.Path & "\"
If IsNumeric(n) Then
f = Dir(p & n & ".xlsx")
If f <> "" Then
With Workbooks.Open(p & n & ".xlsx", 0)
wb.Sheets(1).[a2] = .Sheets(1).[a2]
.Close 0
End With
Else
wb.Sheets(1).[a2] = Empty
End If
End If
Application.ScreenUpdating = True
Beep
End Sub
Sub 按钮2_Click()
n = Application.InputBox("请输入提取的工作簿序号:", "输入数字:", 1, , , , , 1)
Set wb = ThisWorkbook
p = wb.Path & "\"
If IsNumeric(n) Then
f = Dir(p & n & ".xlsx")
If f <> "" Then
With Workbooks.Open(p & n & ".xlsx", 0)
.Sheets(1).Activate
[a2].Select
End With
End If
End If
Beep
End Sub
|
|