gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 21:57:41 25 4
gpt4 key购买 nike

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

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

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com