如何用vba在excel中读取某列的数据添加到另一表的对应行
3个回答
展开全部
Sub iTans()
Dim a, r, rg As Range
Set rg = Sheet1.Range("A1:A9")
a= rg
With Sheet2
r = .Cells(Rows.Count, "A").End(xlUp).Row
.Cells(r + 1, "A").Resize(UBound(a, 2), UBound(a, 1)) _
= Application.Transpose(a)
End With
End Sub
展开全部
Public Sub 痒痒养羊()
For i = 1 To 3
For j = 2 To 4
If Left(Sheet2.Cells(1, i), 1) = Sheet1.Cells(j, 1) Then
k = Sheet2.Cells(1, i).End(xlDown).Row
For m = 2 To k
Sheet1.Cells(j, m) = Sheet2.Cells(m, i)
Next
End If
Next
Next
End Sub
For i = 1 To 3
For j = 2 To 4
If Left(Sheet2.Cells(1, i), 1) = Sheet1.Cells(j, 1) Then
k = Sheet2.Cells(1, i).End(xlDown).Row
For m = 2 To k
Sheet1.Cells(j, m) = Sheet2.Cells(m, i)
Next
End If
Next
Next
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-11-01 · 知道合伙人软件行家
关注
展开全部
for i=1 to 100
Sheet2.range("A" & i)=Sheet1.range("A" & i)
next
Sheet2.range("A" & i)=Sheet1.range("A" & i)
next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询