Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Change cells color & cells contains if formula

I'm new to excel vba. I'm tried out the vba code for changing cells
color but it don't work if my cells contains a if formula (eg. all
cells in cloumn A contain =if(and(b1="Rej",c1="Rej"),"Rej",....). Any
idea what should be the code?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Change cells color & cells contains if formula

Perhaps this little code snippet will point you in the right direction:

Sub FormulaCellColor()

Dim varVal As Variant
Dim strCell As String
Dim r As Range

Range("A1").Select
varVal = ActiveCell.Value

Do Until varVal = ""
Set r = ActiveCell
If r.HasFormula Then
With r
.Interior.Color = vbBlue
.Font.Color = vbWhite
End With
End If
ActiveCell.Offset(1).Select
Loop

Set r = Nothing

End Sub


--
Kevin Backmann


"dot" wrote:

I'm new to excel vba. I'm tried out the vba code for changing cells
color but it don't work if my cells contains a if formula (eg. all
cells in cloumn A contain =if(and(b1="Rej",c1="Rej"),"Rej",....). Any
idea what should be the code?


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
Cells won't change font color or show hi-lighted cells in document ROBIN Excel Discussion (Misc queries) 1 March 27th 08 09:39 PM
change color of all cells with formula or are part of a formula [email protected] Excel Discussion (Misc queries) 19 January 28th 08 01:21 AM
Change the color of cells having formula. Arup C[_2_] Excel Discussion (Misc queries) 5 November 2nd 07 10:50 AM
Change font and background color of several cells based on result of a formula Zenaida Excel Discussion (Misc queries) 2 April 27th 06 06:46 PM
Change color in cells garr Excel Discussion (Misc queries) 5 April 12th 06 12:11 AM


All times are GMT +1. The time now is 06:46 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"