View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default replace a single character WITH FORMAT in a cell

On Mon, 22 Feb 2010 20:17:43 -0800, "L. Howard Kittle"
wrote:

Hi Ron,

Pretty neat lil macro...!

Two questions please, I have Option Explicit active.

Dim s As String * 1

Why the... String * 1

And with this line of code

.Font.TintAndShade = 0

I have to edit out or I get an error:

Run-time 438
Object doesn't support this property or method.

VBA help says the TintAndShade value can be a -1 or 1 for light to dark.

Not a major issue in my world but just curious.

Regards,
Howard

"ela" wrote in message
...
if i have a cell as "I am a boy"

and I would like to replace all the a's in this cell with red a's

How can i achieve that? it seems Excel will replace the whole cell content
into red...



Thanks.

String * 1 declares a String constant with a length of one. Look up
fixed-length strings. If you try to enter a longer string, s will return just
the first letter. And the OP wrote he wanted to change "single" character.

With regard to TintAndShade, that was added in 2007, and can be a value
*BETWEEN* -1 and +1.



--ron