问题描述
在比较两列A和BI时,能够使用条件格式突出显示两列中的唯一数据,但现在的问题是我想将这个突出显示的数据从B复制并粘贴到A列中,所以我很期待对于VBA代码,可以执行此任务从B列复制突出显示的数据并将其粘贴到A列中
赞
A12 =狗
B12 =猫
B12用红色突出显示使用条件格式
所以IF用RED突出显示,B12 = A12
最终输出:
B12 =猫
A12 =猫
我是什么尝试过:
我知道如何将数据从一个单元格复制到另一个单元格
Sub CopyValue()
ActiveSheet.Range(A12)。Value = ActiveSheet.Range(B12)
End Sub
但是如何应用后突出显示的部分有点困难,因为我不知道VBA。
while comparing two columns A and B I am able to highlight the unique data in both the columns using conditional formatting but now the problem is that I want to copy and paste this highlighted data from B into the column A so I am looking forward for a VBA code that can do this task of copying the highlighted data from Column B and paste it into the column A
Like
A12= dog
B12= cat
B12 is highlighted with RED using conditional formatting
so IF highlighted with RED, B12=A12
final output:
B12=cat
A12=cat
What I have tried:
I know how to copy data from one cell to another
Sub CopyValue()
ActiveSheet.Range("A12").Value = ActiveSheet.Range("B12")
End Sub
But how to apply the after highlighted part is a little difficult as I have no idea of VBA.
推荐答案
这篇关于如果使用条件格式突出显示数据,则如何将数据从列复制并粘贴到另一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!