Format selected character in a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an protected spreadsheet and I want to create a macro that when the
user select a portion of the text in a cell (not the cell), I apply a
standard formating to this particular selection.

How can I do that??

Thanks
 
record a macro while doing it manually and you will see how to use
CHARACTERS. Then, just use what you need. Comment out or delete lines not
needed.

sub dochar
With ActiveCell.Characters(Start:=4, Length:=2).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 11
' .Strikethrough = False
' .Superscript = False
' .Subscript = False
' .OutlineFont = False
' .Shadow = False
' .Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
end sub
 
Biche

Macros won't run when in Edit mode.

You'll have to find some other method.


Gord Dibben MS Excel MVP
 
This is what I'm trying to find...

Gord Dibben said:
Biche

Macros won't run when in Edit mode.

You'll have to find some other method.


Gord Dibben MS Excel MVP
 
Something like this for example?

Sub CellFont()
Dim ostart As Integer
Dim onum As Integer
ostart = InputBox("enter character start number")
onum = InputBox("enter numbers of characters to format")
ActiveSheet.Unprotect Password:="justme"
With ActiveCell.Characters(Start:=ostart, Length:=onum).Font
.ColorIndex = 3
.Bold = True
.Underline = True
.Size = 14
End With
ActiveSheet.Protect Password:="justme"
End Sub


Gord
 
I think I will be using InputBox and/or form do that, since I can't do it
more easily.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top