Initializing a cell after testing the color of another cell from a different column

Hi :I upload an excel spreadsheet into SQL, and of course I loose ALL the cell color attributs...
What is the VBA code to update a column flag after testing another  cell's color ?
Thank you.

pfraysse99Asked:
Who is Participating?
 
SiddharthRoutConnect With a Mentor Commented:
If you want to use it as a formula then paste this in a module

Function CheckFontColor(ByVal rng As Range) As Long
    CheckFontColor = rng.Font.ColorIndex
End Function

Open in new window


and then use the formula

=IF(CheckFontColor(A1)<>1,B1="X",B1)

Sid
0
 
SiddharthRoutCommented:
You can use the .Interior.ColoIndex property to check if a cell has color or not for example

If Range("A1").Interior.ColorIndex = 3 Then
    MsgBox "Cell's color is red"
End If

Open in new window


Sid
0
 
pfraysse99Author Commented:
Hi - This is a good start..
I actually want to test the cell string's color ... since default is black, I want to test "NOT Black" ..
Thx
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
SiddharthRoutCommented:
In that case use this :)

if Range("A1").Font.ColorIndex <> 1 then

1 is for Default.

Sid
0
 
pfraysse99Author Commented:
Sid - When I plug this syntax in the EXCEL formula :
=IF(Range("A1").Font.ColorIndex <> 1 , B1="X",B1)
I get Error on [Font.ColorIndex]... ???

0
 
SiddharthRoutCommented:
That is because the code that I gave above is VBA has to be run from VBE.

Sid
0
 
pfraysse99Author Commented:
it looks like I will make it works...Thank you !
0
 
SiddharthRoutCommented:
Let me know if you are still stuck,

Sid
0
 
TracyVBA DeveloperCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.