[英]How do I transpose a range of data from one sheet to another
I believe I am correctly coping the range I need from my second worksheet but I do not understand where/how the paste works. 我相信我从第二个工作表中正确地解决了我需要的范围,但是我不知道粘贴的位置/工作方式。 I am trying to paste to a different worksheet. 我正在尝试粘贴到另一个工作表。
Sub Click()
Dim rng As Range
Dim dat As Variant
With Worksheets(2)
Set rng = .[d31:o31]
dat = rng
rng.Clear
.Range(rng.Cells(1, 1), Cells(rng.Row, rng.Rows.Count)) = Application.Transpose(dat)
End With
End Sub
Use the Upper Boundaries of the array to determine the size of the destination. 使用数组的上边界确定目标的大小。
Explicit parent worksheet references will help to determine proper range references. 明确的父级工作表引用将有助于确定适当的范围引用。
Sub Click()
Dim dat As Variant
With Worksheets(2)
with .range(.cells(31, "D"), .cells(31, "O"))
dat = .value
.Clear
.Cells(1, 1).resize(ubound(dat, 2), ubound(dat, 1)) = _
Application.Transpose(dat)
end with
End With
End Sub
Within .range(.cells(31, "D"), .cells(31, "O"))
, .Cells(1, 1)
is .cells(31, "D")
on the worksheet. 在.range(.cells(31, "D"), .cells(31, "O"))
, .Cells(1, 1)
是工作表上的.cells(31, "D")
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.