如何知道何时使用事件将新超链接添加到工作表

How to know when a new hyperlink is added to a worksheet using an event

我需要我的代码来自动更改我新创建的超链接名称的字体并更改它的其他字体属性,所以我需要我的代码来检测何时将新的超链接添加到工作表。

"Worksheet_Change" 和 "Worksheet_FollowHyperlink" 没有帮助。

更新:这是我的代码:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim WB As Workbook
Dim WS As Worksheet
Dim TA As ListObject
Dim TA_DateCol As ListColumn

Set WB = ThisWorkbook
Set WS = WB.Sheets(1)
Set TA = WS.ListObjects(1)

If Not Intersect(Target, TA.Range) Is Nothing Then
    'This is the part which I want my code to detect if a new hyperlink
    'is added but nothing happens my guess is it's because 'Target' type
    'in this event handler is a 'Range' not a 'Hyperlink'
End If

End Sub

如有任何帮助和建议,我们将不胜感激。The Picture of my code so far

向范围添加超链接不会触发 worksheet_change 事件。

因此无法通过代码检测到这一点。

解决方案是根据您的要求更新工作簿的超链接样式。

有很多教程解释了如何做到这一点,例如https://support.microsoft.com/en-us/office/change-the-font-format-for-hyperlinks-672c2905-ad3e-40be-b281-811e68386243