换种思路后,解决。现在菜单栏做一个按钮。
Sub 复制选定连续单元格()
Dim Wb As Workbook
Dim h, arr1, Name
Dim rng As Range
On Error Resume Next
Name = ActiveWorkbook.Name
For Each Wb In Workbooks
If Wb.Name = "资料库.xls" Then
h = h + 1
End If
Next
Workbooks("资料库.xls").Activate
If h < 1 Then
Workbooks.Open Filename:=ThisWorkbook.Path & "\资料库.xls" End If
Set rng = Application.InputBox("请选择需要复制的区域", "提示选择", , , , , , 8)
arr1 = rng.Value
Workbooks(Name).Activate
Cells(Range("A65536").End(xlUp).Row + 1, 1).Resize(UBound(arr1), UBound(arr1, 2)) = arr1
End Sub
|