excel - 女士 EXCEL : Copy contents of Clicked/Active Cell to another Cell

标签 excel click cell

这似乎是一项相当容易的任务,但是自从我尝试了几种解决方案以来,不知何故没有任何效果......

我想要一些东西,假设我们有这张表:

enter image description here

单击单元格时随机 ,该文本的值/内容应显示在橙色框中。

That's the first and most important part.



第二件事是:
如果可能,所有其他包含相同值的单元格应以绿色背景突出显示/阴影(见图)

enter image description here

我努力了:
https://www.ablebits.com/office-addins-blog/2015/02/10/excel-indirect-function/

http://www.contextures.com/xlFunctions05.html

https://support.office.com/en-us/article/Hide-or-display-cell-values-c94b3493-7762-4a53-8461-fb5cd9f05c33

https://support.office.com/en-us/article/CELL-function-51bd39a5-f338-4dbe-a33f-955d67c2b2cf

先感谢您。

EDIT 1: PS: Preferably a Non-VB solution. However, if a VB solution would be all there is, then your VB suggestions would be highly appreciated

最佳答案

大部分都回答了here所以它只需要编辑一下

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Selection.Count = 1 Then
     'Put in your actual range and the cell where you the text to be shown
        If Not Intersect(Target, Range("B5:D17")) Is Nothing Then
            Selection.Copy Destination:=Range("E2")
        End If
    End If
End Sub

并且可以使用条件格式规则完成着色
=B5=$E$2

假设值从 B5 开始,要显示的文本在 E2 中。

如果您只想将值而不是格式复制到 E2,请替换
Selection.Copy Destination:=Range("E2")


Range("E2").Value = Selection.Value

关于excel - 女士 EXCEL : Copy contents of Clicked/Active Cell to another Cell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41416948/

相关文章:

excel - 从 Excel vba 将“适合”设置为“在 Pdf 中可见”

jQuery Button.click() 事件被触发两次

javascript - 单击并在新选项卡中打开目标,目标为 ="_blank"by jquery/Js

javascript - jQuery 使用一个元素的文本来切换包含相同文本的另一个元素?

cryptography - FPGA逻辑单元数量与性能的关系

GWT 如何将自定义单元格添加到单元格/数据网格

arrays - 当数字重复时,如何找到数组中第 n 个最小的数字?

python - python 中的 xlrd,xlwt (如何复制整行)

excel - 查找在一个范围内具有共同列的唯一单元格的数量

java - 与 JTable 中的单元格渲染器交互