Problem with working with fonts

omidfarrahi

New Member
Joined
Nov 12, 2020
Messages
1
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi
I am working on a cell that some parts are of different fonts. when using replace, the part that I replace works properly and I can change the font. but previous changes in the same cell that i have changed their fonts automatically changes to calibri font.
Private Sub OptionButton2_Click()

' --------------------- Two person verification : --------------

Dim S, celltext As String
Dim location As Integer

Unload Insert_Picture_Selection


Dim DataObj As New MSForms.DataObject

DataObj.GetFromClipboard
S = DataObj.GetText




ActiveCell.Replace What:=S, Replacement:=" E " + S


location = InStr(ActiveCell.Value, S)



'ActiveCell.Characters(start:=location - 1, Length:=1).Text = " = "

'MsgBox ActiveCell.Characters(start:=location - 1, Length:=2).Text

ActiveCell.Characters(start:=location - 2, Length:=1).Font.Name = "Ms Outlook"
ActiveCell.Characters(start:=location - 2, Length:=1).Font.Color = vbBlue
ActiveCell.Characters(start:=location - 2, Length:=1).Font.FontStyle = "Bold"

End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,215,487
Messages
6,125,081
Members
449,205
Latest member
Healthydogs

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
Back
Top