Unable to change link font (keeps changing back to default)

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
948
Office Version
  1. 365
Platform
  1. Windows
Hi

Cell B1 contains a link with the word ACTIVITY. I change the font to Segoe UI size 9 and it works fine until I next open the workbook, when it reverts to the default Comic Sans MS and it's driving me nuts.

I recently changed the default hyperlink font to Comic Sans MS in the Excel Styles toolbar, which I guess is what's causing the problem but I still want all other current and future links to be in Comic Sans MS font.

Help appreciated!

Many thanks
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,171
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Is that the proper name of the Style ??
It look more like a font name ?
If you created a new style using an existing font name I think it would fail.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
948
Office Version
  1. 365
Platform
  1. Windows
Ahh, I didn't know about that, thanks Michael, that's something else I've learnt from you.

I named and applied the new style IronMan to that cell, which worked fine...until I reopened the workbook, when I saw it change back to Comic Sans MS right in front of my eyes during the open event. I just can't see what's happening in the open event that could be causing that to happen.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,171
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
In that case I'm guessing the Hyperlink style will take precendence over any other , if the cell is actually a hyperlink cell
AND
The cells style doesn't seem that much different ??
 

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
948
Office Version
  1. 365
Platform
  1. Windows
This is what's happening with that cell and thanks to your train of thought, I've just located the error!
VBA Code:
Private Sub Workbook_SheetChange(ByVal sh As Object, ByVal target As Range)
 ' The following creates a link in Training Log B1 back to the last amended cell in the workbook

    Dim ws As Worksheet
    Set ws = Worksheets("Training Log")
   
    ws.Hyperlinks.Add Anchor:=ws.Range("B1"), Address:="", SubAddress:= _
          "'" & sh.Name & "'" & "!" & target.Address(0, 0), ScreenTip:="Go to last active cell", TextToDisplay:="ACTIVITY"
    With ws.Range("B1")
.Font.FontStyle = "Segoe UI"
.Font.Size = 9
.Font.Bold = True
End With
End Sub
I changed .Font.FontStyle = "Segoe UI" to .Font.Name = "Segoe UI" and it works fine now.

Thanks a lot Michael!
 
Solution

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,171
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Yeah, kinda thought that would be the issue...glad you got it sorted...(y)
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,611
Messages
5,765,414
Members
425,285
Latest member
andypandypoo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top