对象在2个工作簿之间复制和粘贴所需的错误
Sub CriticalSummerList()
Dim wb1 As Workbook
Dim ws1 As Worksheet
Set wb1 = Workbooks("1")
Set ws1 = wb1.Sheets("Sheet1")
Set wb2 = Workbooks.Open("G:\")
Set ws2 = wb2.Sheets("Sheet1")
Set rng = [B1]
Set rng = Range(rng, Cells(Rows.Count, rng.Column).End(xlUp))
ws2.Select
rng.TextToColumns Destination:=rng, DataType:=xlDelimited
With Range("b1").CurrentRegion
.Sort Key1:=.Range("b1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
Set ws3 = wb2.Sheets("Sheet2")
ws3.Activate
Dim Lastrow As Integer
Lastrow = Cells(Rows.Count, "b").End(xlUp).Offset(0, 0).Row
With ws3
.Range("e2:l" & Lastrow).Copy
End With
wb1.Activate
ws1.Range("E3").Select
wb1.ws1.Paste ws1.[e3]
End Sub
我将WB2.WS2上的范围设置为texttoColumn范围B:b。 从WS3 E2:L到最后一行并粘贴到WB1.WS1。 当我粘贴时,我遇到了这个错误。我尝试了所有其他方法来粘贴数据,但是它不断抛出对象所需的错误。感谢您的帮助。 我将WB2.WS2上的范围设置为texttoColumn范围B:b。 从WS3 E2:L到最后一行并粘贴到WB1.WS1。 当我粘贴时,我遇到了这个错误。我尝试了所有其他方法来粘贴数据,但是它不断抛出对象所需的错误。感谢您的帮助。
Sub CriticalSummerList()
Dim wb1 As Workbook
Dim ws1 As Worksheet
Set wb1 = Workbooks("1")
Set ws1 = wb1.Sheets("Sheet1")
Set wb2 = Workbooks.Open("G:\")
Set ws2 = wb2.Sheets("Sheet1")
Set rng = [B1]
Set rng = Range(rng, Cells(Rows.Count, rng.Column).End(xlUp))
ws2.Select
rng.TextToColumns Destination:=rng, DataType:=xlDelimited
With Range("b1").CurrentRegion
.Sort Key1:=.Range("b1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
Set ws3 = wb2.Sheets("Sheet2")
ws3.Activate
Dim Lastrow As Integer
Lastrow = Cells(Rows.Count, "b").End(xlUp).Offset(0, 0).Row
With ws3
.Range("e2:l" & Lastrow).Copy
End With
wb1.Activate
ws1.Range("E3").Select
wb1.ws1.Paste ws1.[e3]
End Sub
I'm setting the range on wb2.ws2 to texttocolumn range B:B.
Copy from ws3 e2:L to last row and paste to wb1.ws1.
It is when i paste that i come across this error. I tried all other ways to paste the data however it keeps throwing object required error. Thank you for your help.
I'm setting the range on wb2.ws2 to texttocolumn range B:B.
Copy from ws3 e2:L to last row and paste to wb1.ws1.
It is when i paste that i come across this error. I tried all other ways to paste the data however it keeps throwing object required error. Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论