A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Dear Hannes,
I hope you’re having a good day.
Based on my testing, a Shape in Excel retains its existing fill colour after a hyperlink is manually assigned. In other words, adding a hyperlink to a Shape does not automatically change the Shape formatting. Excel exposes the Shape's Hyperlink object through VBA, but there is no built-in VBA event that fires specifically when a hyperlink is added to a Shape.
If your goal is to use the Shape colour as a status indicator (for example, Red = no file linked, Green = file linked), one approach is to run a VBA procedure that checks whether the Shape contains a hyperlink and then updates its colour accordingly. The Shape.Hyperlink property can be used for this purpose.
Example:
Sub UpdateShapeColor()
Dim shp As Shape
Set shp = ActiveSheet.Shapes("
On Error Resume Next
If shp.Hyperlink.Address <> "" Then
shp.Fill.ForeColor.RGB = RGB(0, 176, 80) ' Green
Else
shp.Fill.ForeColor.RGB = RGB(255, 0, 0) ' Red
End If
On Error GoTo 0
End Sub
I hope this information helps point you in the right direction. If you run into any issues while trying the steps, or if something still doesn’t feel quite right, please don’t hesitate to reach out again. I’ll do my best to support you however I can.
Looking forward to hearing back from you with any updates or additional details.
Warm regards,
If the answer is helpful, please select "Yes" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in the forum documentation to enable email notifications if you want to receive the related email notification for this thread.