简体   繁体   English

如何将一系列数据从一张纸转换到另一张纸

[英]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.

相关问题 如何使用 VBA 将遵循特定字符串的动态数据范围从一张纸复制到另一张纸? - How do I copy a dynamic range of data that follows a specific string from one sheet to another using VBA? 如何在一张纸到另一张纸中的特定单元格的范围内复制单元格数据? - How do you copy cell data in a range from one sheet to specific cells in another sheet? 如何将数据从一个Excel工作表复制到另一个Excel工作表? - How do I copy data from one excel sheet to another excel sheet? 如何使用输入从某张纸上的一行中复制某些数据并在另一张纸上显示 - Using an input how do I copy certain data from a row on one sheet and display it in another sheet VBA:将一组范围数据从一个工作簿转换到另一个工作簿 - VBA: Transpose a Set range data from one workbook to another Excel 2007 VBA:如何从一张纸上的动态范围复制和粘贴到另一张纸的第一行? - Excel 2007 VBA: How do I copy and paste from a dynamic range on one sheet to the first empty row of another sheet? 需要帮助编写宏以显示从一张纸到另一张纸的数据转置 - Need help in write macro to show data transpose from one sheet to another sheet 如何将数据从一本书的范围复制到另一本书的范围? - How do I copy data from range of one book to range in another book? 使用VBA自动将一系列数据从一张纸传输到另一张纸 - Automatically transfering a range of data from one sheet to another using VBA 将数据从一个Excel工作表传输到另一个工作表时需要转置行 - Need to transpose rows while transferring data from one excel sheet to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM