ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format selected character in a cell (https://www.excelbanter.com/excel-programming/390173-format-selected-character-cell.html)

Biche

Format selected character in a cell
 
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

Don Guillett

Format selected character in a cell
 
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
--
Don Guillett
SalesAid Software

"Biche" wrote in message
...
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



Gord Dibben

Format selected character in a cell
 
Biche

Macros won't run when in Edit mode.

You'll have to find some other method.


Gord Dibben MS Excel MVP

On Fri, 25 May 2007 13:27:00 -0700, Biche
wrote:

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



Biche

Format selected character in a cell
 
This is what I'm trying to find...

"Gord Dibben" wrote:

Biche

Macros won't run when in Edit mode.

You'll have to find some other method.


Gord Dibben MS Excel MVP

On Fri, 25 May 2007 13:27:00 -0700, Biche
wrote:

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




Gord Dibben

Format selected character in a cell
 
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

On Sat, 26 May 2007 05:45:02 -0700, Biche
wrote:

This is what I'm trying to find...

"Gord Dibben" wrote:

Biche

Macros won't run when in Edit mode.

You'll have to find some other method.


Gord Dibben MS Excel MVP

On Fri, 25 May 2007 13:27:00 -0700, Biche
wrote:

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





Biche

Format selected character in a cell
 
I think I will be using InputBox and/or form do that, since I can't do it
more easily.

Thanks

"Gord Dibben" wrote:

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

On Sat, 26 May 2007 05:45:02 -0700, Biche
wrote:

This is what I'm trying to find...

"Gord Dibben" wrote:

Biche

Macros won't run when in Edit mode.

You'll have to find some other method.


Gord Dibben MS Excel MVP

On Fri, 25 May 2007 13:27:00 -0700, Biche
wrote:

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






All times are GMT +1. The time now is 11:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com