我可以使用VBA使Excel忘记它跟在超链接后面吗? [英] Can I use VBA to make Excel forget that it followed a hyperlink?

查看:76
本文介绍了我可以使用VBA使Excel忘记它跟在超链接后面吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用条件格式来影响表中包含超链接的某些单元格上的字体颜色。但是,当我跟随超链接时,它会覆盖不希望的单元格中的条件格式。



如果紧接上方的单元格,则条件格式本质上使文本不可见。当前单元格具有相同的值。它使用在整个范围( $ C $ 6:$ C $ 24 )内应用的公式( = C5 = C6 )。



我尝试过的事情:




  • 关闭并重新打开文件解决了此问题,因为它将所有
    的跟随超链接重置为普通超链接。但是,我不希望
    始终关闭并重新打开。

  • 我可以使用 Worksheet_FollowHyperlink 事件,以更改字体颜色,但是当我对表进行不同的排序(从而更改条件格式应如何操作)时,
    的条件格式仍被禁用-现在支持以编程方式应用的字体
    颜色。



这个问题本质上是我以前的帖子的更新(



这是我点击后得到的不良行为链接:



解决方案

您还没有透露CF中使用的格式,但是我猜测它会将文本颜色设置为白色。



更好的常规隐藏单元格内容的格式为 ;;; 。如果您在CF中使用此功能,则后面的超链接将保持隐藏状态


I'm using conditional formatting to affect font color on certain cells containing hyperlinks in a table. When I follow the hyperlink, though, it overrides the conditional formatting in the cell, which is undesired.

The conditional formatting is essentially making the text invisible if the cell immediately above the current cell has the same value. It uses a formula (=C5=C6) applied throughout the range ($C$6:$C$24).

Things I've tried:

  • Closing and re-opening the file fixes the issue because it resets all the followed hyperlinks back to normal hyperlinks. However, I don't want to have to close and re-open all the time.
  • I can use the Worksheet_FollowHyperlink event to change the font color back, but when I sort the table differently (thus changing how the conditional formatting should act), the conditional formatting is still disabled -- now in favor of the programatically-applied font color.

This question is essentially an update of my previous post (Is there a way to make Conditional Formatting ignore the FollowedHyperlink flag?). I'm no longer using the HYPERLINK formula, since that wasn't allowing me to use the Worksheet_FollowHyperlink option provided in an answer.

I've also read through the provided SuperUser thread (https://superuser.com/questions/728825/how-do-i-prevent-excel-from-changing-the-color-of-a-clicked-link/819931), which provided some other interesting avenues to pursue, but didn't quite get me where I needed to be. I'm specifically asking now if I can reset Excel's memory of which hyperlinks have been followed.

This is want I want, both before and after clicking the link:

This is the undesired behavior that I get after clicking the link:

解决方案

You haven't disclosed what format you are using in your CF, but I'm guessing it's setting text colour to white.

A Far better general format for hiding a cells contents is ;;;. If you use this in your CF, then a followed hyperlink remains hidden

这篇关于我可以使用VBA使Excel忘记它跟在超链接后面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆