VBA粘贴为值-如何 [英] VBA paste as values - how to

查看:105
本文介绍了VBA粘贴为值-如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些VBA代码,可以从一个工作表中复制一个范围,然后将其粘贴到第一行空白处.它要复制的是vlookup公式,因此在粘贴时粘贴所有0,我该如何将其复制的值粘贴为值,以便保留结果?

I have some VBA code that copys a range from one sheet and then pastes it to another at the first blank line. What it is copying are vlookup formulas so when it pastes it pastes all 0's, how would I go about getting it to paste what it copies as values so the results are retained?

代码:

Private Sub PasteChartDataQtyCompare()
'This step pastes the range of values to the chart data tab
    Sheets(1).Range("A6:J22").Copy _
    Destination:=Sheets("Chart Data").Cells(Sheets("Chart Data").Rows.Count, 1).End(xlUp).Offset(1, 0)
End Sub

推荐答案

直接绕过剪贴板传输值.

Transfer the values directly bypassing the clipboard.

Private Sub PasteChartDataQtyCompare()
    'This step pastes the range of values to the chart data tab
    with workSheets(1).Range("A6:J22")
        workSheets("Chart Data").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).resize(.rows.count,.columns.count) = .value
    end with
End Sub

这篇关于VBA粘贴为值-如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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