将数据复制到Excel中另一个工作表上的特定单元格范围 [英] Copy data to a specific cell range on another worksheet in excel

查看:273
本文介绍了将数据复制到Excel中另一个工作表上的特定单元格范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI我有这个代码可以很好地复制和附加数据到一个单独的工作表,但是我希望它粘贴到目标表中的特定单元格范围,我如何去修改它?

HI I have this code which works well to copy and append data to a separate worksheet however I want it to paste to a specific cell range in the destination sheet, how do I go about ammending it?

Sub SummurizeSheets()
    Dim ws As Worksheet

    Application.ScreenUpdating = False
    Sheets("Summary").Activate

    For Each ws In Worksheets
        If ws.Name <> "Summary" Then
            ws.Range("D2:D6, D8:D15").Copy
            Worksheets("Summary").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
        End If
    Next ws
End Sub


推荐答案

修改此行,以便引用所需的工作表和单元格地址:

Modify this line so that it refers to the desired Worksheet and cell(s) address:

Worksheets("Summary").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)

例如,这将它放在名为另一个工作表名称的工作表中,在列F中,而不是列C:

For example, this puts it on a worksheet named "Another Sheet Name" and in column F, instead of column C:

Worksheets("Another Sheet Name").Cells(Rows.Count, 6).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)

更新:您正在使用一个有点动态的范围,与 Offset 方法。如果您无法将此值粘贴到所需位置,请告诉我该位置是什么,我可以给出更详细的答案。

Update: You are using a somewhat dynamic range already, in conjunction with the Offset method. If you have trouble getting this to paste the values to the desired location, let me know what that location is and I can give more detailed answer.

这篇关于将数据复制到Excel中另一个工作表上的特定单元格范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆