PC Review


Reply
Thread Tools Rate Thread

Cell Fill Colors

 
 
=?Utf-8?B?ZGJpemVr?=
Guest
Posts: n/a
 
      31st Jan 2007
Is there a way to program cell fill colors on and off.
Either using the "IF" statement or some other way?
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      31st Jan 2007
Conditional formatting, see http://xldynamic.com/source/xld.CF.html

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"dbizek" <(E-Mail Removed)> wrote in message
news:5616B811-D90E-4094-BEF4-(E-Mail Removed)...
> Is there a way to program cell fill colors on and off.
> Either using the "IF" statement or some other way?



 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      31st Jan 2007
if <your condition> then
range().Interior.ColorIndex = ' enter a # 1 thru 56
end if

susan

On Jan 31, 9:59 am, dbizek <dbi...@discussions.microsoft.com> wrote:
> Is there a way to program cell fill colors on and off.
> Either using the "IF" statement or some other way?



 
Reply With Quote
 
Juan Pablo González
Guest
Posts: n/a
 
      31st Jan 2007
Take a look at Conditional Formatting in the Format menu. You can use a
cell value or a formula that evaluates to TRUE/FALSE to assign a format to
cells, including the fill color.

--
Regards,

Juan Pablo González

"dbizek" <(E-Mail Removed)> wrote in message
news:5616B811-D90E-4094-BEF4-(E-Mail Removed)...
> Is there a way to program cell fill colors on and off.
> Either using the "IF" statement or some other way?



 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      31st Jan 2007
Yes, use the formula option in conditional formatting. Post the condition you
want to evaluate if you need more assistance



"dbizek" wrote:

> Is there a way to program cell fill colors on and off.
> Either using the "IF" statement or some other way?

 
Reply With Quote
 
Michael Kimmerly
Guest
Posts: n/a
 
      31st Jan 2007
Pardon me for the semi-hijack. Can you automatically format the text only
portion of a numeric-text string in a cell. For instance, can you bold only
the text in a string such as "$20,000 High Sales" making the text bold or a
different color while the numbers stay in standard format?

Thanks


On 1/31/07 9:13 AM, in article
00A98272-95A0-4C31-BA92-(E-Mail Removed), "Mike"
<(E-Mail Removed)> wrote:

> Yes, use the formula option in conditional formatting. Post the condition you
> want to evaluate if you need more assistance
>
>
>
> "dbizek" wrote:
>
>> Is there a way to program cell fill colors on and off.
>> Either using the "IF" statement or some other way?


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      31st Jan 2007
Not without VBA.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit
Dim i As Long

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
For i = 1 To Len(.Value)
If IsNumeric(Mid(.Value, i, 1)) Then
.Characters(i, 1).Font.Bold = True
End If
Next i
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Michael Kimmerly" <(E-Mail Removed)> wrote in message
news:C1E61DBF.114FA%(E-Mail Removed)...
> Pardon me for the semi-hijack. Can you automatically format the text only
> portion of a numeric-text string in a cell. For instance, can you bold
> only
> the text in a string such as "$20,000 High Sales" making the text bold or
> a
> different color while the numbers stay in standard format?
>
> Thanks
>
>
> On 1/31/07 9:13 AM, in article
> 00A98272-95A0-4C31-BA92-(E-Mail Removed), "Mike"
> <(E-Mail Removed)> wrote:
>
>> Yes, use the formula option in conditional formatting. Post the condition
>> you
>> want to evaluate if you need more assistance
>>
>>
>>
>> "dbizek" wrote:
>>
>>> Is there a way to program cell fill colors on and off.
>>> Either using the "IF" statement or some other way?

>



 
Reply With Quote
 
Michael Kimmerly
Guest
Posts: n/a
 
      31st Jan 2007
Thanks Bob. Will study the code, been years since I used VB or VBA, but I
assumed it could be done that way. A co-worker thought standard or
conditional formatting could do it but I could not figure a way. Much
Appreciated.




On 1/31/07 10:28 AM, in article #(E-Mail Removed), "Bob
Phillips" <(E-Mail Removed)> wrote:

> Not without VBA.
>
> Option Explicit
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Const WS_RANGE As String = "H1:H10" '<== change to suit
> Dim i As Long
>
> On Error GoTo ws_exit
> Application.EnableEvents = False
>
> If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
> With Target
> For i = 1 To Len(.Value)
> If IsNumeric(Mid(.Value, i, 1)) Then
> .Characters(i, 1).Font.Bold = True
> End If
> Next i
> End With
> End If
>
> ws_exit:
> Application.EnableEvents = True
> End Sub
>
> 'This is worksheet event code, which means that it needs to be
> 'placed in the appropriate worksheet code module, not a standard
> 'code module. To do this, right-click
>


 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      31st Jan 2007
Typo patrol!

Change to If Not IsNumeric for bold text and standard numbers.


Gord Dibben MS Excel MVP

On Wed, 31 Jan 2007 16:28:18 -0000, "Bob Phillips" <(E-Mail Removed)> wrote:

>Not without VBA.
>
>Option Explicit
>
>Private Sub Worksheet_Change(ByVal Target As Range)
>Const WS_RANGE As String = "H1:H10" '<== change to suit
>Dim i As Long
>
> On Error GoTo ws_exit
> Application.EnableEvents = False
>
> If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
> With Target
> For i = 1 To Len(.Value)
> If IsNumeric(Mid(.Value, i, 1)) Then
> .Characters(i, 1).Font.Bold = True
> End If
> Next i
> End With
> End If
>
>ws_exit:
> Application.EnableEvents = True
>End Sub
>
>'This is worksheet event code, which means that it needs to be
>'placed in the appropriate worksheet code module, not a standard
>'code module. To do this, right-click


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      31st Jan 2007
Not a typo Gord, I really thought he wanted the numbers bolded, its the eyes
failing :-(

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Gord Dibben" <gorddibbATshawDOTca> wrote in message
news:(E-Mail Removed)...
> Typo patrol!
>
> Change to If Not IsNumeric for bold text and standard numbers.
>
>
> Gord Dibben MS Excel MVP
>
> On Wed, 31 Jan 2007 16:28:18 -0000, "Bob Phillips" <(E-Mail Removed)>
> wrote:
>
>>Not without VBA.
>>
>>Option Explicit
>>
>>Private Sub Worksheet_Change(ByVal Target As Range)
>>Const WS_RANGE As String = "H1:H10" '<== change to suit
>>Dim i As Long
>>
>> On Error GoTo ws_exit
>> Application.EnableEvents = False
>>
>> If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
>> With Target
>> For i = 1 To Len(.Value)
>> If IsNumeric(Mid(.Value, i, 1)) Then
>> .Characters(i, 1).Font.Bold = True
>> End If
>> Next i
>> End With
>> End If
>>
>>ws_exit:
>> Application.EnableEvents = True
>>End Sub
>>
>>'This is worksheet event code, which means that it needs to be
>>'placed in the appropriate worksheet code module, not a standard
>>'code module. To do this, right-click

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using if function with cell fill colors =?Utf-8?B?UGFt?= Microsoft Excel Programming 4 29th Jan 2006 03:51 AM
Cell fill colors don't appear to work... =?Utf-8?B?Um9i?= Microsoft Excel Misc 1 19th Sep 2005 11:49 PM
Can't format font colors or cell fill-in colors =?Utf-8?B?Y2Fub2Vyb24=?= Microsoft Excel Misc 3 22nd Aug 2005 11:46 PM
Re: More cell fill colors? Chip Pearson Microsoft Excel Misc 0 10th Aug 2004 04:08 PM
Cell Fill Colors between Worksheets Marti Microsoft Excel Worksheet Functions 2 19th Jul 2003 01:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:09 PM.