PC Review


Reply
Thread Tools Rate Thread

Color cell font text based on cell type? How do it.

 
 
Chet
Guest
Posts: n/a
 
      21st Nov 2008
I can write vba code but this has me stumped. Does anyone have an
idea how to format cell text color by the property of the type of cell
it is?

For example if the cell is a constant the font would be red, if the
cell has a formula in it then it would be blue, and if the cell is
linked to another part of the workbook then it would be green.

I would be greatful for any ideas.

Thanks,

Chet
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      22nd Nov 2008
Sub ColorSpecialCellsFont()
'The If statement avoids error message
Set myRange = Sheets(1).Range("b2:b6")
If Not myRange.SpecialCells(xlCellTypeFormulas).Count < 1 Then
myRange.SpecialCells(xlCellTypeFormulas).Font.ColorIndex = 3
End If
End Sub

"Chet" wrote:

> I can write vba code but this has me stumped. Does anyone have an
> idea how to format cell text color by the property of the type of cell
> it is?
>
> For example if the cell is a constant the font would be red, if the
> cell has a formula in it then it would be blue, and if the cell is
> linked to another part of the workbook then it would be green.
>
> I would be greatful for any ideas.
>
> Thanks,
>
> Chet
>

 
Reply With Quote
 
Chet
Guest
Posts: n/a
 
      22nd Nov 2008
On Nov 21, 5:54*pm, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> Sub ColorSpecialCellsFont()
> * *'The If statement avoids error message
> * *Set myRange = Sheets(1).Range("b2:b6")
> * *If Not myRange.SpecialCells(xlCellTypeFormulas).Count < 1 Then
> * * *myRange.SpecialCells(xlCellTypeFormulas).Font.ColorIndex = 3
> * *End If
> End Sub
>
>
>
> "Chet" wrote:
> > I can write vba code but this has me stumped. *Does anyone have an
> > idea how to format cell text color by the property of the type of cell
> > it is?

>
> > For example if the cell is a constant the font would be red, if the
> > cell has a formula in it then it would be blue, and if the cell is
> > linked to another part of the workbook then it would be green.

>
> > I would be greatful for any ideas.

>
> > Thanks,

>
> > Chet- Hide quoted text -

>
> - Show quoted text -


I kind of understand you are doing this, but how would i detect cells
where that particular cell is linked to another cell?
 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      22nd Nov 2008

In that case you look for precedents.

ActiveCell.ShowPrecedents





"Chet" wrote:

> On Nov 21, 5:54 pm, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > Sub ColorSpecialCellsFont()
> > 'The If statement avoids error message
> > Set myRange = Sheets(1).Range("b2:b6")
> > If Not myRange.SpecialCells(xlCellTypeFormulas).Count < 1 Then
> > myRange.SpecialCells(xlCellTypeFormulas).Font.ColorIndex = 3
> > End If
> > End Sub
> >
> >
> >
> > "Chet" wrote:
> > > I can write vba code but this has me stumped. Does anyone have an
> > > idea how to format cell text color by the property of the type of cell
> > > it is?

> >
> > > For example if the cell is a constant the font would be red, if the
> > > cell has a formula in it then it would be blue, and if the cell is
> > > linked to another part of the workbook then it would be green.

> >
> > > I would be greatful for any ideas.

> >
> > > Thanks,

> >
> > > Chet- Hide quoted text -

> >
> > - Show quoted text -

>
> I kind of understand you are doing this, but how would i detect cells
> where that particular cell is linked to another cell?
>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      22nd Nov 2008
Can you clarify something for me? What exactly do you mean when you say "if
the cell is linked to another part of the workbook"?

--
Rick (MVP - Excel)


"Chet" <(E-Mail Removed)> wrote in message
news:1e119fb5-e11b-4c81-99dd-(E-Mail Removed)...
On Nov 21, 5:54 pm, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> Sub ColorSpecialCellsFont()
> 'The If statement avoids error message
> Set myRange = Sheets(1).Range("b2:b6")
> If Not myRange.SpecialCells(xlCellTypeFormulas).Count < 1 Then
> myRange.SpecialCells(xlCellTypeFormulas).Font.ColorIndex = 3
> End If
> End Sub
>
>
>
> "Chet" wrote:
> > I can write vba code but this has me stumped. Does anyone have an
> > idea how to format cell text color by the property of the type of cell
> > it is?

>
> > For example if the cell is a constant the font would be red, if the
> > cell has a formula in it then it would be blue, and if the cell is
> > linked to another part of the workbook then it would be green.

>
> > I would be greatful for any ideas.

>
> > Thanks,

>
> > Chet- Hide quoted text -

>
> - Show quoted text -


I kind of understand you are doing this, but how would i detect cells
where that particular cell is linked to another cell?

 
Reply With Quote
 
Chet
Guest
Posts: n/a
 
      23rd Nov 2008
On Nov 22, 7:24*am, "Rick Rothstein"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
> Can you clarify something for me? What exactly do you mean when you say "if
> the cell is linked to another part of the workbook"?
>
> --
> Rick (MVP - Excel)
>
> "Chet" <chetshan...@gmail.com> wrote in message
>
> news:1e119fb5-e11b-4c81-99dd-(E-Mail Removed)...
> On Nov 21, 5:54 pm, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
>
>
>
>
>
> > Sub ColorSpecialCellsFont()
> > 'The If statement avoids error message
> > Set myRange = Sheets(1).Range("b2:b6")
> > If Not myRange.SpecialCells(xlCellTypeFormulas).Count < 1 Then
> > myRange.SpecialCells(xlCellTypeFormulas).Font.ColorIndex = 3
> > End If
> > End Sub

>
> > "Chet" wrote:
> > > I can write vba code but this has me stumped. Does anyone have an
> > > idea how to format cell text color by the property of the type of cell
> > > it is?

>
> > > For example if the cell is a constant the font would be red, if the
> > > cell has a formula in it then it would be blue, and if the cell is
> > > linked to another part of the workbook then it would be green.

>
> > > I would be greatful for any ideas.

>
> > > Thanks,

>
> > > Chet- Hide quoted text -

>
> > - Show quoted text -

>
> I kind of understand you are doing this, but how would i detect cells
> where that particular cell is linked to another cell?- Hide quoted text -
>
> - Show quoted text -


I wasn't very clear and I gave it some more thought. I'm trying to
show cells in three different ways.

1. A constant just entered as a number
2. A direct link where a cell has contents something like =A5 or
=Sheet2!B8
3. Any other type of formula such as =vlookup(a4,b4:b9,2,0). I
realize that this item is probably a subset of #2 but I am trying to
change the font color on something like this and make it different
than #2. (and different than #1)

Thanks,
Chet
 
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
Changing font color based on type cell it is. How to do it? Chet Microsoft Excel Programming 6 24th Nov 2008 02:30 AM
Change Text Color in one cell based upon entry in referenced cell Tee Microsoft Excel Misc 3 12th Sep 2008 10:07 PM
Re: Changing cell text color based on cell number W. Wheeler Microsoft Excel Programming 0 22nd Apr 2007 11:56 PM
Changing cell text color based on cell number =?Utf-8?B?c2NvdHR5?= Microsoft Excel Programming 9 14th Apr 2007 06:34 AM
Change Font Color in cell Based on another cell value =?Utf-8?B?Sm9obg==?= Microsoft Excel Programming 2 18th Nov 2005 05:28 PM


Features
 

Advertising
 

Newsgroups
 


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