Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ela ela is offline
external usenet poster
 
Posts: 16
Default replace a single character WITH FORMAT in a cell

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...


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 698
Default replace a single character WITH FORMAT in a cell

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...



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 698
Default replace a single character WITH FORMAT in a cell

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...



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format single character alex Excel Worksheet Functions 4 April 17th 09 12:50 PM
find replace excel remove single character AlaskaBoy Excel Discussion (Misc queries) 5 March 31st 08 03:16 PM
find replace the 1st character in a cell Pete Excel Discussion (Misc queries) 2 March 31st 08 07:27 AM
How do I perfom a character count in a single cell in Excel? RonNette72791 New Users to Excel 1 August 11th 06 05:49 PM
How to remove or replace a carriage return character in a cell? Patty Excel Discussion (Misc queries) 2 July 26th 05 06:25 PM


All times are GMT +1. The time now is 03:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"