这似乎是一项相当容易的任务,但是由于我现在已经尝试了几种解决方案,所以没有任何效果。
我想要一些东西,假设我们有这张表:
当随机单击一个单元格时,该文本的值/内容应显示在橙色框中。
这是第一个也是最重要的部分。
第二件事是:如果可能的话,所有其他包含相同值的单元格都应该用绿色背景突出显示/着色(见图)
我试过了: 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.ValueMost 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 Suband the colouring can just be done with a conditional formatting rule
=B5=$E$2assuming 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更多推荐
发布评论