Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default colore cell based on condition

hi everybody,
It is possible to change the color index of a cell with error 2015 (#VALUE!)?
if I get this error-cells colored with orange, then I can check the values
of the rest, somehow is stopping on the ones with errors. All cells I'm
checking are colored yellow, I'm ignoring the rest.

Thanks for any help

sub CheckValue ()

For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 And _
c.Value = CVErr(xlErrValue) Then
c.Interior.ColorIndex = 44

ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Next



End Sub

gaba :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default colore cell based on condition

Gaba,

Your problem is evaluating for an eror when there is not one there. Try
this

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
End If
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
End If
Next
--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
hi everybody,
It is possible to change the color index of a cell with error 2015

(#VALUE!)?
if I get this error-cells colored with orange, then I can check the values
of the rest, somehow is stopping on the ones with errors. All cells I'm
checking are colored yellow, I'm ignoring the rest.

Thanks for any help

sub CheckValue ()

For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 And _
c.Value = CVErr(xlErrValue) Then
c.Interior.ColorIndex = 44

ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Next



End Sub

gaba :)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default colore cell based on condition

Bob, thanks for your answer. I've tried the code and is not catching the
numbers bigger than 9999... Soon as the value is an error quits. Any ideas?
Gaba

"Bob Phillips" wrote:

Gaba,

Your problem is evaluating for an eror when there is not one there. Try
this

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
End If
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
End If
Next
--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
hi everybody,
It is possible to change the color index of a cell with error 2015

(#VALUE!)?
if I get this error-cells colored with orange, then I can check the values
of the rest, somehow is stopping on the ones with errors. All cells I'm
checking are colored yellow, I'm ignoring the rest.

Thanks for any help

sub CheckValue ()

For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 And _
c.Value = CVErr(xlErrValue) Then
c.Interior.ColorIndex = 44

ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Next



End Sub

gaba :)




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default colore cell based on condition

Gaba,

Is this better?

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Err.Clear
End If
End If
Next

--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
Bob, thanks for your answer. I've tried the code and is not catching the
numbers bigger than 9999... Soon as the value is an error quits. Any

ideas?
Gaba

"Bob Phillips" wrote:

Gaba,

Your problem is evaluating for an eror when there is not one there. Try
this

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
End If
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
End If
Next
--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
hi everybody,
It is possible to change the color index of a cell with error 2015

(#VALUE!)?
if I get this error-cells colored with orange, then I can check the

values
of the rest, somehow is stopping on the ones with errors. All cells

I'm
checking are colored yellow, I'm ignoring the rest.

Thanks for any help

sub CheckValue ()

For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 And _
c.Value = CVErr(xlErrValue) Then
c.Interior.ColorIndex = 44

ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Next



End Sub

gaba :)






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default colore cell based on condition

Thanks so much, Bob. It works great!

"Bob Phillips" wrote:

Gaba,

Is this better?

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Err.Clear
End If
End If
Next

--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
Bob, thanks for your answer. I've tried the code and is not catching the
numbers bigger than 9999... Soon as the value is an error quits. Any

ideas?
Gaba

"Bob Phillips" wrote:

Gaba,

Your problem is evaluating for an eror when there is not one there. Try
this

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
End If
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
End If
Next
--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
hi everybody,
It is possible to change the color index of a cell with error 2015
(#VALUE!)?
if I get this error-cells colored with orange, then I can check the

values
of the rest, somehow is stopping on the ones with errors. All cells

I'm
checking are colored yellow, I'm ignoring the rest.

Thanks for any help

sub CheckValue ()

For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 And _
c.Value = CVErr(xlErrValue) Then
c.Interior.ColorIndex = 44

ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Next



End Sub

gaba :)








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default colore cell based on condition

That's good, sorry about the inadequate testing first time.

Bob

"gaba" wrote in message
...
Thanks so much, Bob. It works great!

"Bob Phillips" wrote:

Gaba,

Is this better?

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Err.Clear
End If
End If
Next

--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
Bob, thanks for your answer. I've tried the code and is not catching

the
numbers bigger than 9999... Soon as the value is an error quits. Any

ideas?
Gaba

"Bob Phillips" wrote:

Gaba,

Your problem is evaluating for an eror when there is not one there.

Try
this

On Error Resume Next
For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 Then
If c.Value = CVErr(xlErrValue) Then
If Err.Number = 0 Then
c.Interior.ColorIndex = 44
End If
ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
End If
Next
--

HTH

RP
(remove nothere from the email address if mailing direct)


"gaba" wrote in message
...
hi everybody,
It is possible to change the color index of a cell with error 2015
(#VALUE!)?
if I get this error-cells colored with orange, then I can check

the
values
of the rest, somehow is stopping on the ones with errors. All

cells
I'm
checking are colored yellow, I'm ignoring the rest.

Thanks for any help

sub CheckValue ()

For Each c In Range("E17", "CE44")
If c.Interior.ColorIndex = 6 And _
c.Value = CVErr(xlErrValue) Then
c.Interior.ColorIndex = 44

ElseIf c.Interior.ColorIndex = 6 And _
c.Value 9999 Then
c.Interior.ColorIndex = 44
c.FormatNumber = "0.00"
End If
Next



End Sub

gaba :)








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
lock cell based on a condition Amanda Excel Worksheet Functions 22 June 25th 07 07:53 PM
Condition based on cell colour Richhall Excel Worksheet Functions 2 March 25th 07 04:23 PM
Is there a way to delete a cell value based on a condition? Peanut Excel Discussion (Misc queries) 2 October 2nd 06 09:55 PM
Fill a cell based on a condition being met confused teacher Excel Worksheet Functions 3 July 5th 06 08:29 AM


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