EXCEL女士:将Clicked / Active Cell的内容复制到另一个Cell(Ms EXCEL: Copy contents of Clicked/Active Cell to anothe

编程入门 行业动态 更新时间:2024-10-28 14:26:56
EXCEL女士:将Clicked / Active Cell的内容复制到另一个Cell(Ms EXCEL: Copy contents of Clicked/Active Cell to another Cell)

这似乎是一项相当容易的任务,但是由于我现在已经尝试了几种解决方案,所以没有任何效果。

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

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

这是第一个也是最重要的部分。

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

我试过了: 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

先谢谢你。

编辑1: PS:优选非VB解决方案。 但是,如果VB解决方案就是全部,那么您的VB建议将受到高度赞赏

This seems rather an easy task, but somehow nothing has worked since I have tried several solutions to now...

I want something, supposing we have this sheet:

When a Cell is Clicked randomly, the value/contents of that text should be shown in the Orange Box.

That's the first and most important part.

The second thing to happen is: if possible, all other Cells that contain the same value should be highlighted/shaded with an Green Background (See image)

I have tried: 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

Thank you in advance.

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

最满意答案

大部分都在这里得到解答,所以它只需要编辑一下

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

Most of this is answered here so it just needs editing a bit

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

and the colouring can just be done with a conditional formatting rule

=B5=$E$2

assuming that the values start in B5 and the text to be displayed is in E2.

If you only want to copy the value and not the formatting to E2, replace

Selection.Copy Destination:=Range("E2")

with

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

更多推荐

本文发布于:2023-08-05 08:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1429698.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:女士   内容   Active   EXCEL   Clicked

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!