excel使用VBA调用另一工作薄指定工作表中指定区域的数据
book1中sheet3(A1:W600)要调用(拷贝)book2中sheet2(A1:W600)的数据。我是用下面方法,但太慢。PublicSub导入()Applica...
book1中sheet3(A1:W600)要调用(拷贝)book2中sheet2(A1:W600)的数据。我是用下面方法,但太慢。
Public Sub 导入()
Application.ScreenUpdating = False
Dim Filename As String
Filename = Application.GetOpenFilename
Workbooks.Open Filename
For l = 1 To 600
For h = 1 To 23
ThisWorkbook.Sheets(3).Cells(l, h) = ActiveWorkbook.Sheets(2).Cells(l , h)
Next
Next
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub
public sub a()
Application.ScreenUpdating = False
dim wb as workbook
Dim Filename As String
Filename = Application.GetOpenFilename
Set Wb = GetObject(filename)
range("A1:W600").value=Wb.Sheets(2).Range("A1:W600").value
Set Wb = Nothing
Application.ScreenUpdating = True
End Sub
解决了,两边加.value。谢谢,提供帮助的朋友。 展开
Public Sub 导入()
Application.ScreenUpdating = False
Dim Filename As String
Filename = Application.GetOpenFilename
Workbooks.Open Filename
For l = 1 To 600
For h = 1 To 23
ThisWorkbook.Sheets(3).Cells(l, h) = ActiveWorkbook.Sheets(2).Cells(l , h)
Next
Next
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub
public sub a()
Application.ScreenUpdating = False
dim wb as workbook
Dim Filename As String
Filename = Application.GetOpenFilename
Set Wb = GetObject(filename)
range("A1:W600").value=Wb.Sheets(2).Range("A1:W600").value
Set Wb = Nothing
Application.ScreenUpdating = True
End Sub
解决了,两边加.value。谢谢,提供帮助的朋友。 展开
展开全部
不用那样,直接用:
sheet3.range("A1:W600")=sheet2.range("A1:W600") 就行了。
这样试试,:
range("A1:W600")=Wb.Sheets(2).Range("A1:W600")
`
sheet3.range("A1:W600")=sheet2.range("A1:W600") 就行了。
这样试试,:
range("A1:W600")=Wb.Sheets(2).Range("A1:W600")
`
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询