#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Font

How do I write a macro or if-then statement to examine the font colour in a
cell and then return a value dependant on the colour?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Font

I,m not sure what you mean by return a value dependant on font colour but
determining the colour is easy enough. The code below returns the colourindex
number of the active cell.

Sub FontColor()
MsgBox "The Font Color Index is " & ActiveCell.Font.ColorIndex
End Sub

Mike

"sgdav" wrote:

How do I write a macro or if-then statement to examine the font colour in a
cell and then return a value dependant on the colour?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Font

This function returns colorindices of the cell given as first argument,
depending on the second argument. If it's TRUE, then returns font colorindex,
if FALSE, returns background colorindex.

Function WhatColor(cella As Range, fontbackgr As Boolean)
Application.Volatile
If fontbackgr Then
WhatColor = cella.Font.ColorIndex
Else
WhatColor = cella.Interior.ColorIndex
End If
End Function

Regards,
Stefi

sgdav ezt *rta:

How do I write a macro or if-then statement to examine the font colour in a
cell and then return a value dependant on the colour?

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
Change all text one font size up with various font sizes used. omchrystal New Users to Excel 2 March 6th 07 09:01 PM
Changed default font, previous font still shows when editing Font/Editing Problem Excel Discussion (Misc queries) 1 May 19th 06 12:46 PM
Changed default font, previous font still shows when editing Font/Editing Problem Excel Discussion (Misc queries) 0 May 18th 06 04:37 PM
change display font to actual selected font Flannigan Excel Discussion (Misc queries) 1 August 30th 05 01:46 PM
Font changes Jauchart Charts and Charting in Excel 1 August 29th 05 09:54 PM


All times are GMT +1. The time now is 07:56 AM.

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

About Us

"It's about Microsoft Excel"