Search : in
By :

Changing font colour

Last answer on May 19, 2009 3:31:16 pm BST Ancon, on May 19, 2009 2:03:24 pm BST 
 Report this message to moderators

Hi,
I've looked at some posts on your site and followed the advice, however I can't get this to work.
I'd like to change the font colour of a range of cells depending on whether it contains a formula or text.
Initially all cells in the range contain a formula, but if a formula is overwritten I'd like the colour to change to remind the user that the cell no longer contains a formula.

Sub Lock_AllSnCells()
Dim aCell As Range
Dim bCell As Range
Dim cCell As Range
Set aRange = Range("AA7:AD36")
Set bRange = Range("BC7:BF36")
Set cRange = Range("BN7:BU36")
ActiveSheet.Unprotect
'--
'For Each aCell In aRange
' If Left(aCell.Formula, 1) <> "=" Then
' aCell.Font.ColorIndex = xlNone
' aCell.Font.Color = vbRed
' End If
'Next aCell
For Each cell In aRange
cell.Font.Color = vbBlue
Next cell
For i = 7 To 36
checkcell = Range("AA" & i).Formula Like "*[A-N]*"
If checkcell = True Then
Range("AA" & i).Font.Color = vbRed
End If
Next
aRange.Select
With Selection
Selection.Locked = True
Selection.FormulaHidden = True
End With
Set aCell = Nothing
Set aRange = Nothing

Ranges b and c are repeats of the above.

I've tried a couple of ways with the same result - the sub runs and changes the first cell then stops. No error message, just stops.

Any suggestions would be much appreciated.
Thanks

Configuration: Windows XP
Firefox 3.0.10

Best answers for « Changing font colour » in :
Changing your desktop background! ShowChanging your desktop background! Desktop background is the image or wallpaper that is being used as background on a computer screen. Wallpaper is the common terms used for designating the graphical interface in Microsoft Windows. Below...
Changing the color of the command prompt(shell) ShowChanging the color of the command prompt(shell) Purpose Methods Purpose Changing the color of characters in the prompt (or shell), make them more readable. If you are using colors group, you can sense by color, this will eliminate the...
Personalize web pages with GreaseMonkey ShowPersonalize web pages with GreaseMonkey What is GreaseMonkey? Example 1 Example 2 XPath Utilities removeElement() removeAttributeOfElement() setAttributeOfElement() injectCSS() Links What is GreaseMonkey? GreaseMonkey is an...
Download FontKat Font Cataloger ShowFontKat Font Cataloger has been designed to create a custom catalog of the available fonts. With the printed list of the installed fonts, the selection of the right fonts for your work is easier and quicker. It is even possible to display the...
Download Pnotes ShowPNotes is a virtual note management program. The notes which you create are customizable in a individual way. You can modify: - the appearance of the software ( skin ), - its level of transparency, - the text style, - the font colour. There...
The Colour Table ShowCoding colours In HTML, colours are defined by three hexadecimal numbers, which represent the Red, Green, and Blue tones (using RGB coding) of the chosen colour. This is the syntax for coding a colour in HTML: color="#RRGGBB" RR, GG and BB each...
Backgrounds ShowAdding a Background Image A background image for a web page can be set using the tag: Attribute Visual Effect BACKGROUND="image" Displays image as background bgcolor="name_of_Colour or #XXXXXX" Displays the given colour...
Resistance to change ShowResistance to change To be in a position to anticipate change, it is essential to understand the risk factors and in particular the causes that prevent change. Apart from individual causes, before focusing attention on a case by case basis,...

1

sarbel.vilo, on May 19, 2009 2:28:16 pm BST

Mate i don't get it, i know that if you want to change font colors, go in format cells.

Reply to sarbel.vilo

2

 Ancon, on May 19, 2009 3:31:16 pm BST
  • +2

Sorry, I didn't explain it well enough. Other people are using this spreadsheet and so I wanted to change the colour automatically using a macro. I used conditional formatting but it made the whole workbook too big (file size) and cumbersome. Anyway, I now have the problem sorted - when I deleted the conditional formatting (CF) I missed a couple of cells and that was all it was that was stopping the macro running. I read somewhere that CF caused some problems with macros.
Thanks anyway.

Reply to Ancon