Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Cell Fill Colors

Is there a way to program cell fill colors on and off.
Either using the "IF" statement or some other way?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Cell Fill Colors

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" wrote in message
...
Is there a way to program cell fill colors on and off.
Either using the "IF" statement or some other way?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Cell Fill Colors

if <your condition then
range().Interior.ColorIndex = ' enter a # 1 thru 56
end if

susan

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Cell Fill Colors

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" wrote in message
...
Is there a way to program cell fill colors on and off.
Either using the "IF" statement or some other way?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Cell Fill Colors

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?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Cell Fill Colors

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
, "Mike"
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?


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Cell Fill Colors

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" wrote in message
...
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
, "Mike"
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?




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Cell Fill Colors

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 , "Bob
Phillips" 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


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Cell Fill Colors

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


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Cell Fill Colors

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






  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Cell Fill Colors

I stand corrected on the "typo" pickup.

Now......if we could just get the eyesight corrected as easily<g


On Wed, 31 Jan 2007 19:03:07 -0000, "Bob Phillips" wrote:

Not a typo Gord, I really thought he wanted the numbers bolded, its the eyes
failing :-(


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
Used drawing colors in shapes....lost default colors for "Fill Col Lai704 Excel Discussion (Misc queries) 1 August 20th 08 04:45 AM
Using if function with cell fill colors Pam Excel Programming 4 January 29th 06 03:51 AM
Cell fill colors don't appear to work... Rob Excel Discussion (Misc queries) 1 September 19th 05 11:49 PM
Can't format font colors or cell fill-in colors canoeron Excel Discussion (Misc queries) 3 August 22nd 05 11:46 PM
How do I fill row colors based on cell value? Daskeeper Excel Discussion (Misc queries) 1 January 31st 05 10:12 AM


All times are GMT +1. The time now is 06:00 AM.

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"