Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Highlight text (interior color)

Hello!

Is it possible to chane the interior color of a text depending upon the
length of text?
If the text is just fitting the cell we can change the interior color.
But if the text extends to the next cell how we can identify this? I
dont want to change the column width of course.

so what i am looking for is a way to identify the text length and if it
streches to next cells then change the interior color of those cells
too.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Highlight text (interior color)

Hi Abdul - try this,- its not perfect, but somthing to work with

Sub Fit()
Dim r As Range
Dim u, x
For Each r In ActiveSheet.UsedRange
u = 0
For x = 1 To Len(r.Value)
If Mid(r.Value, x, 1) = UCase(Mid(r.Value, x, 1)) And Mid(r.Value, x, 1) <
"" Then u = u + 1
Next
If r.ColumnWidth < Len(r.Value) + Int((u / 3)) And r.Value < "" Then
r.Interior.ColorIndex = 3
If r.ColumnWidth Len(r.Value) + Int((u / 3)) Or r.Value = "" Then
r.Interior.ColorIndex = xlNone
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Highlight text (interior color)

There are some methods here
http://www.dicks-blog.com/archives/2005/05/16/1131/

Mine is in posts 4, 5 & 6, I had problems posting the code, firstly

Dim va(0 to 8) arrived as Dim va(0 to smiley

then the <= sign in what should have been
Do While w <= wd
terminated posts 4 & 5

knowing that I hope you can piece it together.

Regards,
Peter T


"Abdul" wrote in message
ps.com...
Hello!

Is it possible to chane the interior color of a text depending upon the
length of text?
If the text is just fitting the cell we can change the interior color.
But if the text extends to the next cell how we can identify this? I
dont want to change the column width of course.

so what i am looking for is a way to identify the text length and if it
streches to next cells then change the interior color of those cells
too.

Thanks



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
Cell background color (interior color) setting not working Martin E. Excel Programming 1 May 21st 06 07:00 PM
Interior color Paal Excel Programming 1 March 20th 06 03:38 PM
Interior color Paal Excel Programming 0 March 20th 06 02:51 PM
Passing Back Color to Interior Color ExcelMonkey[_190_] Excel Programming 1 March 22nd 05 04:27 PM


All times are GMT +1. The time now is 08:40 PM.

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

About Us

"It's about Microsoft Excel"