Thread: VBA Event
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default VBA Event

Steve,

The workbook-sheet change applies to all sheets.

Alt+F11 to open VB editor. Double click 'This workbook' and paste this in on
the right

Note I've commented out .tintshade because that doesn't work in 2003 in fact
i'm only assuming it works in another version, I've never heard of it

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Hyperlinks.Count = 1 Then Target.Select
With Selection.Font
.Color = -16776961
'.TintAndShade = 0
End With
End Sub

Mike

"Steve" wrote:

In my entire workbook, I want to be able to change of the font of a cell when
the cell has a hyperlink in it.
This VB works if you paste it in each worksheet:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Hyperlinks.Count = 1 Then Target.Select
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With


End Sub


but instead of pasting 100+ worksheets in the workbook, where should I place
this code?



--
Steve