Why excel cell color did not change after formatting and VBA code?

I am using excel 2000 and having some problems with two particular cells 
(which contained formulas) in my worksheet. I have been using both 
conditional formatting and VBA to change the color of two cells according to 
some conditions: 

Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else 
change it to Red 

I have tested both method seperately (VBA and Conditional Formatting) and 
there is nothing wrong with the result except whenever the cell P18 value is 
re-calculated to zero, it will ALWAYS stay as Red... 

I have even try to force the formatting by giving an extra line of code to 
make sure when the cell is zero, it will be red...but this is not the case. 

VBA code for one cell: 

Private Sub Worksheet_Calculate() 

Dim ucell1 As Range 
Dim ucell2 As Range 
Dim lcell1 As Range 
Dim lcell2 As Range 
Dim tcell1 As Range 
Dim tcell2 As Range 

Set ucell1 = Range("R18") 
Set lcell1 = Range("S18") 
Set ucell2 = Range("R21") 
Set lcell2 = Range("S21") 
Set tcell1 = Range("P18") 
Set tcell2 = Range("P21") 

If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") > 
lcell1 Or Range("P18").Value = lcell1.Value) Then 
Range("P18").Interior.ColorIndex = 29 
ElseIf Range("P18").Value = lcell1.Value Then 
Range("P18").Interior.ColorIndex = 29 
ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then 
Range("P18").Interior.ColorIndex = 3 
End If 

End Sub 

I would be grateful if someone could provide some advices as to why the cell 
stay on Red when it is zero? 

Any help will be much appreciated 

Best Regards 
Casey Wong
0
CaseyWong (4)
11/7/2007 3:41:07 PM
excel 39879 articles. 2 followers. Follow

7 Replies
513 Views

Similar Articles

[PageSpeed] 14

Casey,

Conditional Formatting takes precedence over standard formatting.  You need to delete the CF on the 
cell to get the standard formatting to show.

HTH,
Bernie
MS Excel MVP


"Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message 
news:DC1422AA-BCD1-433F-9C0F-0113642CECF7@microsoft.com...
>I am using excel 2000 and having some problems with two particular cells
> (which contained formulas) in my worksheet. I have been using both
> conditional formatting and VBA to change the color of two cells according to
> some conditions:
>
> Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else
> change it to Red
>
> I have tested both method seperately (VBA and Conditional Formatting) and
> there is nothing wrong with the result except whenever the cell P18 value is
> re-calculated to zero, it will ALWAYS stay as Red...
>
> I have even try to force the formatting by giving an extra line of code to
> make sure when the cell is zero, it will be red...but this is not the case.
>
> VBA code for one cell:
>
> Private Sub Worksheet_Calculate()
>
> Dim ucell1 As Range
> Dim ucell2 As Range
> Dim lcell1 As Range
> Dim lcell2 As Range
> Dim tcell1 As Range
> Dim tcell2 As Range
>
> Set ucell1 = Range("R18")
> Set lcell1 = Range("S18")
> Set ucell2 = Range("R21")
> Set lcell2 = Range("S21")
> Set tcell1 = Range("P18")
> Set tcell2 = Range("P21")
>
> If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") >
> lcell1 Or Range("P18").Value = lcell1.Value) Then
> Range("P18").Interior.ColorIndex = 29
> ElseIf Range("P18").Value = lcell1.Value Then
> Range("P18").Interior.ColorIndex = 29
> ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then
> Range("P18").Interior.ColorIndex = 3
> End If
>
> End Sub
>
> I would be grateful if someone could provide some advices as to why the cell
> stay on Red when it is zero?
>
> Any help will be much appreciated
>
> Best Regards
> Casey Wong 


0
Bernie
11/7/2007 4:00:52 PM
Hi Bernie,

Thanks for your reply.  I have deleted the CF and only using VBA code still 
the problem exist.  It seem to be a bit strange, as the VBA code has 
specified clearly which colors to use on what condition, but this seem to be 
not working for the two particular cells?  Am I missing something? Is this an 
excel application problem or simply a setting problem?

Regards
Casey

"Bernie Deitrick" wrote:

> Casey,
> 
> Conditional Formatting takes precedence over standard formatting.  You need to delete the CF on the 
> cell to get the standard formatting to show.
> 
> HTH,
> Bernie
> MS Excel MVP
> 
> 
> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message 
> news:DC1422AA-BCD1-433F-9C0F-0113642CECF7@microsoft.com...
> >I am using excel 2000 and having some problems with two particular cells
> > (which contained formulas) in my worksheet. I have been using both
> > conditional formatting and VBA to change the color of two cells according to
> > some conditions:
> >
> > Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else
> > change it to Red
> >
> > I have tested both method seperately (VBA and Conditional Formatting) and
> > there is nothing wrong with the result except whenever the cell P18 value is
> > re-calculated to zero, it will ALWAYS stay as Red...
> >
> > I have even try to force the formatting by giving an extra line of code to
> > make sure when the cell is zero, it will be red...but this is not the case.
> >
> > VBA code for one cell:
> >
> > Private Sub Worksheet_Calculate()
> >
> > Dim ucell1 As Range
> > Dim ucell2 As Range
> > Dim lcell1 As Range
> > Dim lcell2 As Range
> > Dim tcell1 As Range
> > Dim tcell2 As Range
> >
> > Set ucell1 = Range("R18")
> > Set lcell1 = Range("S18")
> > Set ucell2 = Range("R21")
> > Set lcell2 = Range("S21")
> > Set tcell1 = Range("P18")
> > Set tcell2 = Range("P21")
> >
> > If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") >
> > lcell1 Or Range("P18").Value = lcell1.Value) Then
> > Range("P18").Interior.ColorIndex = 29
> > ElseIf Range("P18").Value = lcell1.Value Then
> > Range("P18").Interior.ColorIndex = 29
> > ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then
> > Range("P18").Interior.ColorIndex = 3
> > End If
> >
> > End Sub
> >
> > I would be grateful if someone could provide some advices as to why the cell
> > stay on Red when it is zero?
> >
> > Any help will be much appreciated
> >
> > Best Regards
> > Casey Wong 
> 
> 
> 
0
CaseyWong (4)
11/7/2007 4:17:01 PM
Casey,

Your code only works on one cell, not two or more.  Perhaps you have other code?  Do you have a ogic 
for your formatting?

Anyway, try this for cell P18.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Calculate()

Dim ucell1 As Range
Dim ucell2 As Range
Dim lcell1 As Range
Dim lcell2 As Range
Dim tcell1 As Range
Dim tcell2 As Range

Set ucell1 = Range("R18")
Set lcell1 = Range("S18")
Set ucell2 = Range("R21")
Set lcell2 = Range("S21")
Set tcell1 = Range("P18")
Set tcell2 = Range("P21")

If (Range("P18").Value < ucell1.Value Or Range("P18") = ucell1.Value) _
   And (Range("P18").Value > lcell1.Value Or Range("P18").Value = lcell1.Value) Then
      Range("P18").Interior.ColorIndex = 29
      Range("P18").FormatConditions.Delete
ElseIf Range("P18").Value = lcell1.Value Then
   Range("P18").Interior.ColorIndex = 29
      Range("P18").FormatConditions.Delete
ElseIf Range("P18").Value > ucell1.Value Or Range("P18").Value < lcell1.Value Then
   Range("P18").Interior.ColorIndex = 3
      Range("P18").FormatConditions.Delete
End If

End Sub


"Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message 
news:E2323C22-466A-43A3-9277-F2745FEE3E4C@microsoft.com...
> Hi Bernie,
>
> Thanks for your reply.  I have deleted the CF and only using VBA code still
> the problem exist.  It seem to be a bit strange, as the VBA code has
> specified clearly which colors to use on what condition, but this seem to be
> not working for the two particular cells?  Am I missing something? Is this an
> excel application problem or simply a setting problem?
>
> Regards
> Casey
>
> "Bernie Deitrick" wrote:
>
>> Casey,
>>
>> Conditional Formatting takes precedence over standard formatting.  You need to delete the CF on 
>> the
>> cell to get the standard formatting to show.
>>
>> HTH,
>> Bernie
>> MS Excel MVP
>>
>>
>> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
>> news:DC1422AA-BCD1-433F-9C0F-0113642CECF7@microsoft.com...
>> >I am using excel 2000 and having some problems with two particular cells
>> > (which contained formulas) in my worksheet. I have been using both
>> > conditional formatting and VBA to change the color of two cells according to
>> > some conditions:
>> >
>> > Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else
>> > change it to Red
>> >
>> > I have tested both method seperately (VBA and Conditional Formatting) and
>> > there is nothing wrong with the result except whenever the cell P18 value is
>> > re-calculated to zero, it will ALWAYS stay as Red...
>> >
>> > I have even try to force the formatting by giving an extra line of code to
>> > make sure when the cell is zero, it will be red...but this is not the case.
>> >
>> > VBA code for one cell:
>> >
>> > Private Sub Worksheet_Calculate()
>> >
>> > Dim ucell1 As Range
>> > Dim ucell2 As Range
>> > Dim lcell1 As Range
>> > Dim lcell2 As Range
>> > Dim tcell1 As Range
>> > Dim tcell2 As Range
>> >
>> > Set ucell1 = Range("R18")
>> > Set lcell1 = Range("S18")
>> > Set ucell2 = Range("R21")
>> > Set lcell2 = Range("S21")
>> > Set tcell1 = Range("P18")
>> > Set tcell2 = Range("P21")
>> >
>> > If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") >
>> > lcell1 Or Range("P18").Value = lcell1.Value) Then
>> > Range("P18").Interior.ColorIndex = 29
>> > ElseIf Range("P18").Value = lcell1.Value Then
>> > Range("P18").Interior.ColorIndex = 29
>> > ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then
>> > Range("P18").Interior.ColorIndex = 3
>> > End If
>> >
>> > End Sub
>> >
>> > I would be grateful if someone could provide some advices as to why the cell
>> > stay on Red when it is zero?
>> >
>> > Any help will be much appreciated
>> >
>> > Best Regards
>> > Casey Wong
>>
>>
>> 


0
Bernie
11/7/2007 5:43:26 PM
Hi Bernie,

Thanks for the reply and sorry to bother you with this again.  Yes the code 
does contain another part for cell P21 but I have shorten my codes for this 
post.  I have tried the code you suggested but the problem still remain.  I 
hvae also tested the following codes and the results are explained after the 
codes (I have only use cell P18 as example in the code):  
_________________________________________
Test 1: If cell P18 = 0 (Cell S18), cell P18 is Green  

If Range("P18") = Range("S18") Then
    Range("P18").FormatConditions.Delete
    Range("P18").Interior.ColorIndex = 29  'green color
    
End If

Result: cell P18 stay in the previous color and did not change to green
__________________________________________________________
Test 2: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green, 
else it is red

If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
    Range("P18").FormatConditions.Delete
    Range("P18").Interior.ColorIndex = 29
    
Else 
    Range("P18").FormatConditions.Delete
    Range("P18").Interior.ColorIndex = 3
End If

Result: All conditions are met except when P18 = zero, it will stay as 
previous color and not green
________________________________________________________________
Test 3: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green, 
else if P18 = 0 then it is also green

If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
    Range("P18").FormatConditions.Delete
    Range("P18").Interior.ColorIndex = 29
    
ElseIf Range("P18") = Range("S18") Then 
    Range("P18").FormatConditions.Delete
    Range("P18").Interior.ColorIndex = 29
End If

Result: All conditions are met and P18 turned green, values > 1 and < 0 also 
became green.
________________________________________________________________

Test 4: Same with above except added code to set red color to cell > 1 and < 0

If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
    
    Range("P18").Interior.ColorIndex = 29
    Range("P18").FormatConditions.Delete
    
ElseIf Range("P18") = Range("S18") Then
    
    Range("P18").Interior.ColorIndex = 29
    Range("P18").FormatConditions.Delete
    
ElseIf Range("P18") > Range("R18") Or Range("P18") < Range("S18") Then
    Range("P18").FormatConditions.Delete
    Range("P18").Interior.ColorIndex = 3
    
End If

Result: All conditions are met except when P18=0, it stays as previous color 
and not green.
_______________________________________________________

Any help and advice will be much appreciated!

Many thanks

Best Regards
Casey Wong

"Bernie Deitrick" wrote:

> Casey,
> 
> Your code only works on one cell, not two or more.  Perhaps you have other code?  Do you have a ogic 
> for your formatting?
> 
> Anyway, try this for cell P18.
> 
> HTH,
> Bernie
> MS Excel MVP
> 
> Private Sub Worksheet_Calculate()
> 
> Dim ucell1 As Range
> Dim ucell2 As Range
> Dim lcell1 As Range
> Dim lcell2 As Range
> Dim tcell1 As Range
> Dim tcell2 As Range
> 
> Set ucell1 = Range("R18")
> Set lcell1 = Range("S18")
> Set ucell2 = Range("R21")
> Set lcell2 = Range("S21")
> Set tcell1 = Range("P18")
> Set tcell2 = Range("P21")
> 
> If (Range("P18").Value < ucell1.Value Or Range("P18") = ucell1.Value) _
>    And (Range("P18").Value > lcell1.Value Or Range("P18").Value = lcell1.Value) Then
>       Range("P18").Interior.ColorIndex = 29
>       Range("P18").FormatConditions.Delete
> ElseIf Range("P18").Value = lcell1.Value Then
>    Range("P18").Interior.ColorIndex = 29
>       Range("P18").FormatConditions.Delete
> ElseIf Range("P18").Value > ucell1.Value Or Range("P18").Value < lcell1.Value Then
>    Range("P18").Interior.ColorIndex = 3
>       Range("P18").FormatConditions.Delete
> End If
> 
> End Sub
> 
> 
> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message 
> news:E2323C22-466A-43A3-9277-F2745FEE3E4C@microsoft.com...
> > Hi Bernie,
> >
> > Thanks for your reply.  I have deleted the CF and only using VBA code still
> > the problem exist.  It seem to be a bit strange, as the VBA code has
> > specified clearly which colors to use on what condition, but this seem to be
> > not working for the two particular cells?  Am I missing something? Is this an
> > excel application problem or simply a setting problem?
> >
> > Regards
> > Casey
> >
> > "Bernie Deitrick" wrote:
> >
> >> Casey,
> >>
> >> Conditional Formatting takes precedence over standard formatting.  You need to delete the CF on 
> >> the
> >> cell to get the standard formatting to show.
> >>
> >> HTH,
> >> Bernie
> >> MS Excel MVP
> >>
> >>
> >> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
> >> news:DC1422AA-BCD1-433F-9C0F-0113642CECF7@microsoft.com...
> >> >I am using excel 2000 and having some problems with two particular cells
> >> > (which contained formulas) in my worksheet. I have been using both
> >> > conditional formatting and VBA to change the color of two cells according to
> >> > some conditions:
> >> >
> >> > Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else
> >> > change it to Red
> >> >
> >> > I have tested both method seperately (VBA and Conditional Formatting) and
> >> > there is nothing wrong with the result except whenever the cell P18 value is
> >> > re-calculated to zero, it will ALWAYS stay as Red...
> >> >
> >> > I have even try to force the formatting by giving an extra line of code to
> >> > make sure when the cell is zero, it will be red...but this is not the case.
> >> >
> >> > VBA code for one cell:
> >> >
> >> > Private Sub Worksheet_Calculate()
> >> >
> >> > Dim ucell1 As Range
> >> > Dim ucell2 As Range
> >> > Dim lcell1 As Range
> >> > Dim lcell2 As Range
> >> > Dim tcell1 As Range
> >> > Dim tcell2 As Range
> >> >
> >> > Set ucell1 = Range("R18")
> >> > Set lcell1 = Range("S18")
> >> > Set ucell2 = Range("R21")
> >> > Set lcell2 = Range("S21")
> >> > Set tcell1 = Range("P18")
> >> > Set tcell2 = Range("P21")
> >> >
> >> > If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") >
> >> > lcell1 Or Range("P18").Value = lcell1.Value) Then
> >> > Range("P18").Interior.ColorIndex = 29
> >> > ElseIf Range("P18").Value = lcell1.Value Then
> >> > Range("P18").Interior.ColorIndex = 29
> >> > ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then
> >> > Range("P18").Interior.ColorIndex = 3
> >> > End If
> >> >
> >> > End Sub
> >> >
> >> > I would be grateful if someone could provide some advices as to why the cell
> >> > stay on Red when it is zero?
> >> >
> >> > Any help will be much appreciated
> >> >
> >> > Best Regards
> >> > Casey Wong
> >>
> >>
> >> 
> 
> 
> 
0
CaseyWong (4)
11/8/2007 9:53:03 AM
Casey,

Try this:

> Test 1: If cell P18 = 0 (Cell S18), cell P18 is Green

Range("P18").Value = Range("S18").Value
If Range("P18").Value = Range("S18").Value Then
   MsgBox "I am now reformatting P18"
   Range("P18").FormatConditions.Delete
   Range("P18").Interior.ColorIndex = 29  'green color
End If


For me, 29 is not green - it is purple (at least on my system, XL2002).

What happens? Then try this, to try a different color:

Range("P18").Value = Range("S18").Value
If Range("P18").Value = Range("S18").Value Then
   MsgBox "I am now reformatting P18"
   Range("P18").FormatConditions.Delete
   Range("P18").Interior.ColorIndex = 3  'RED
End If

HTH,
Bernie
MS Excel MVP


"Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message 
news:99FD2821-4ADA-40DD-A149-943FDB217404@microsoft.com...
> Hi Bernie,
>
> Thanks for the reply and sorry to bother you with this again.  Yes the code
> does contain another part for cell P21 but I have shorten my codes for this
> post.  I have tried the code you suggested but the problem still remain.  I
> hvae also tested the following codes and the results are explained after the
> codes (I have only use cell P18 as example in the code):
> _________________________________________
> Test 1: If cell P18 = 0 (Cell S18), cell P18 is Green
>
> If Range("P18") = Range("S18") Then
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 29  'green color
>
> End If
>
> Result: cell P18 stay in the previous color and did not change to green
> __________________________________________________________
> Test 2: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green,
> else it is red
>
> If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 29
>
> Else
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 3
> End If
>
> Result: All conditions are met except when P18 = zero, it will stay as
> previous color and not green
> ________________________________________________________________
> Test 3: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green,
> else if P18 = 0 then it is also green
>
> If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 29
>
> ElseIf Range("P18") = Range("S18") Then
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 29
> End If
>
> Result: All conditions are met and P18 turned green, values > 1 and < 0 also
> became green.
> ________________________________________________________________
>
> Test 4: Same with above except added code to set red color to cell > 1 and < 0
>
> If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
>
>    Range("P18").Interior.ColorIndex = 29
>    Range("P18").FormatConditions.Delete
>
> ElseIf Range("P18") = Range("S18") Then
>
>    Range("P18").Interior.ColorIndex = 29
>    Range("P18").FormatConditions.Delete
>
> ElseIf Range("P18") > Range("R18") Or Range("P18") < Range("S18") Then
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 3
>
> End If
>
> Result: All conditions are met except when P18=0, it stays as previous color
> and not green.
> _______________________________________________________
>
> Any help and advice will be much appreciated!
>
> Many thanks
>
> Best Regards
> Casey Wong
>
> "Bernie Deitrick" wrote:
>
>> Casey,
>>
>> Your code only works on one cell, not two or more.  Perhaps you have other code?  Do you have a 
>> ogic
>> for your formatting?
>>
>> Anyway, try this for cell P18.
>>
>> HTH,
>> Bernie
>> MS Excel MVP
>>
>> Private Sub Worksheet_Calculate()
>>
>> Dim ucell1 As Range
>> Dim ucell2 As Range
>> Dim lcell1 As Range
>> Dim lcell2 As Range
>> Dim tcell1 As Range
>> Dim tcell2 As Range
>>
>> Set ucell1 = Range("R18")
>> Set lcell1 = Range("S18")
>> Set ucell2 = Range("R21")
>> Set lcell2 = Range("S21")
>> Set tcell1 = Range("P18")
>> Set tcell2 = Range("P21")
>>
>> If (Range("P18").Value < ucell1.Value Or Range("P18") = ucell1.Value) _
>>    And (Range("P18").Value > lcell1.Value Or Range("P18").Value = lcell1.Value) Then
>>       Range("P18").Interior.ColorIndex = 29
>>       Range("P18").FormatConditions.Delete
>> ElseIf Range("P18").Value = lcell1.Value Then
>>    Range("P18").Interior.ColorIndex = 29
>>       Range("P18").FormatConditions.Delete
>> ElseIf Range("P18").Value > ucell1.Value Or Range("P18").Value < lcell1.Value Then
>>    Range("P18").Interior.ColorIndex = 3
>>       Range("P18").FormatConditions.Delete
>> End If
>>
>> End Sub
>>
>>
>> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
>> news:E2323C22-466A-43A3-9277-F2745FEE3E4C@microsoft.com...
>> > Hi Bernie,
>> >
>> > Thanks for your reply.  I have deleted the CF and only using VBA code still
>> > the problem exist.  It seem to be a bit strange, as the VBA code has
>> > specified clearly which colors to use on what condition, but this seem to be
>> > not working for the two particular cells?  Am I missing something? Is this an
>> > excel application problem or simply a setting problem?
>> >
>> > Regards
>> > Casey
>> >
>> > "Bernie Deitrick" wrote:
>> >
>> >> Casey,
>> >>
>> >> Conditional Formatting takes precedence over standard formatting.  You need to delete the CF 
>> >> on
>> >> the
>> >> cell to get the standard formatting to show.
>> >>
>> >> HTH,
>> >> Bernie
>> >> MS Excel MVP
>> >>
>> >>
>> >> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
>> >> news:DC1422AA-BCD1-433F-9C0F-0113642CECF7@microsoft.com...
>> >> >I am using excel 2000 and having some problems with two particular cells
>> >> > (which contained formulas) in my worksheet. I have been using both
>> >> > conditional formatting and VBA to change the color of two cells according to
>> >> > some conditions:
>> >> >
>> >> > Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else
>> >> > change it to Red
>> >> >
>> >> > I have tested both method seperately (VBA and Conditional Formatting) and
>> >> > there is nothing wrong with the result except whenever the cell P18 value is
>> >> > re-calculated to zero, it will ALWAYS stay as Red...
>> >> >
>> >> > I have even try to force the formatting by giving an extra line of code to
>> >> > make sure when the cell is zero, it will be red...but this is not the case.
>> >> >
>> >> > VBA code for one cell:
>> >> >
>> >> > Private Sub Worksheet_Calculate()
>> >> >
>> >> > Dim ucell1 As Range
>> >> > Dim ucell2 As Range
>> >> > Dim lcell1 As Range
>> >> > Dim lcell2 As Range
>> >> > Dim tcell1 As Range
>> >> > Dim tcell2 As Range
>> >> >
>> >> > Set ucell1 = Range("R18")
>> >> > Set lcell1 = Range("S18")
>> >> > Set ucell2 = Range("R21")
>> >> > Set lcell2 = Range("S21")
>> >> > Set tcell1 = Range("P18")
>> >> > Set tcell2 = Range("P21")
>> >> >
>> >> > If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") >
>> >> > lcell1 Or Range("P18").Value = lcell1.Value) Then
>> >> > Range("P18").Interior.ColorIndex = 29
>> >> > ElseIf Range("P18").Value = lcell1.Value Then
>> >> > Range("P18").Interior.ColorIndex = 29
>> >> > ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then
>> >> > Range("P18").Interior.ColorIndex = 3
>> >> > End If
>> >> >
>> >> > End Sub
>> >> >
>> >> > I would be grateful if someone could provide some advices as to why the cell
>> >> > stay on Red when it is zero?
>> >> >
>> >> > Any help will be much appreciated
>> >> >
>> >> > Best Regards
>> >> > Casey Wong
>> >>
>> >>
>> >>
>>
>>
>> 


0
Bernie
11/8/2007 1:29:25 PM
Hi Bernie,

I have run the code you have suggested and the cell P18 changed to Green 
after the first code and to Red after the second code.....what should be my 
next step?

Best Regards
Casey 

"Bernie Deitrick" wrote:

> Casey,
> 
> Try this:
> 
> > Test 1: If cell P18 = 0 (Cell S18), cell P18 is Green
> 
> Range("P18").Value = Range("S18").Value
> If Range("P18").Value = Range("S18").Value Then
>    MsgBox "I am now reformatting P18"
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 29  'green color
> End If
> 
> 
> For me, 29 is not green - it is purple (at least on my system, XL2002).
> 
> What happens? Then try this, to try a different color:
> 
> Range("P18").Value = Range("S18").Value
> If Range("P18").Value = Range("S18").Value Then
>    MsgBox "I am now reformatting P18"
>    Range("P18").FormatConditions.Delete
>    Range("P18").Interior.ColorIndex = 3  'RED
> End If
> 
> HTH,
> Bernie
> MS Excel MVP
> 
> 
> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message 
> news:99FD2821-4ADA-40DD-A149-943FDB217404@microsoft.com...
> > Hi Bernie,
> >
> > Thanks for the reply and sorry to bother you with this again.  Yes the code
> > does contain another part for cell P21 but I have shorten my codes for this
> > post.  I have tried the code you suggested but the problem still remain.  I
> > hvae also tested the following codes and the results are explained after the
> > codes (I have only use cell P18 as example in the code):
> > _________________________________________
> > Test 1: If cell P18 = 0 (Cell S18), cell P18 is Green
> >
> > If Range("P18") = Range("S18") Then
> >    Range("P18").FormatConditions.Delete
> >    Range("P18").Interior.ColorIndex = 29  'green color
> >
> > End If
> >
> > Result: cell P18 stay in the previous color and did not change to green
> > __________________________________________________________
> > Test 2: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green,
> > else it is red
> >
> > If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
> >    Range("P18").FormatConditions.Delete
> >    Range("P18").Interior.ColorIndex = 29
> >
> > Else
> >    Range("P18").FormatConditions.Delete
> >    Range("P18").Interior.ColorIndex = 3
> > End If
> >
> > Result: All conditions are met except when P18 = zero, it will stay as
> > previous color and not green
> > ________________________________________________________________
> > Test 3: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green,
> > else if P18 = 0 then it is also green
> >
> > If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
> >    Range("P18").FormatConditions.Delete
> >    Range("P18").Interior.ColorIndex = 29
> >
> > ElseIf Range("P18") = Range("S18") Then
> >    Range("P18").FormatConditions.Delete
> >    Range("P18").Interior.ColorIndex = 29
> > End If
> >
> > Result: All conditions are met and P18 turned green, values > 1 and < 0 also
> > became green.
> > ________________________________________________________________
> >
> > Test 4: Same with above except added code to set red color to cell > 1 and < 0
> >
> > If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
> >
> >    Range("P18").Interior.ColorIndex = 29
> >    Range("P18").FormatConditions.Delete
> >
> > ElseIf Range("P18") = Range("S18") Then
> >
> >    Range("P18").Interior.ColorIndex = 29
> >    Range("P18").FormatConditions.Delete
> >
> > ElseIf Range("P18") > Range("R18") Or Range("P18") < Range("S18") Then
> >    Range("P18").FormatConditions.Delete
> >    Range("P18").Interior.ColorIndex = 3
> >
> > End If
> >
> > Result: All conditions are met except when P18=0, it stays as previous color
> > and not green.
> > _______________________________________________________
> >
> > Any help and advice will be much appreciated!
> >
> > Many thanks
> >
> > Best Regards
> > Casey Wong
> >
> > "Bernie Deitrick" wrote:
> >
> >> Casey,
> >>
> >> Your code only works on one cell, not two or more.  Perhaps you have other code?  Do you have a 
> >> ogic
> >> for your formatting?
> >>
> >> Anyway, try this for cell P18.
> >>
> >> HTH,
> >> Bernie
> >> MS Excel MVP
> >>
> >> Private Sub Worksheet_Calculate()
> >>
> >> Dim ucell1 As Range
> >> Dim ucell2 As Range
> >> Dim lcell1 As Range
> >> Dim lcell2 As Range
> >> Dim tcell1 As Range
> >> Dim tcell2 As Range
> >>
> >> Set ucell1 = Range("R18")
> >> Set lcell1 = Range("S18")
> >> Set ucell2 = Range("R21")
> >> Set lcell2 = Range("S21")
> >> Set tcell1 = Range("P18")
> >> Set tcell2 = Range("P21")
> >>
> >> If (Range("P18").Value < ucell1.Value Or Range("P18") = ucell1.Value) _
> >>    And (Range("P18").Value > lcell1.Value Or Range("P18").Value = lcell1.Value) Then
> >>       Range("P18").Interior.ColorIndex = 29
> >>       Range("P18").FormatConditions.Delete
> >> ElseIf Range("P18").Value = lcell1.Value Then
> >>    Range("P18").Interior.ColorIndex = 29
> >>       Range("P18").FormatConditions.Delete
> >> ElseIf Range("P18").Value > ucell1.Value Or Range("P18").Value < lcell1.Value Then
> >>    Range("P18").Interior.ColorIndex = 3
> >>       Range("P18").FormatConditions.Delete
> >> End If
> >>
> >> End Sub
> >>
> >>
> >> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
> >> news:E2323C22-466A-43A3-9277-F2745FEE3E4C@microsoft.com...
> >> > Hi Bernie,
> >> >
> >> > Thanks for your reply.  I have deleted the CF and only using VBA code still
> >> > the problem exist.  It seem to be a bit strange, as the VBA code has
> >> > specified clearly which colors to use on what condition, but this seem to be
> >> > not working for the two particular cells?  Am I missing something? Is this an
> >> > excel application problem or simply a setting problem?
> >> >
> >> > Regards
> >> > Casey
> >> >
> >> > "Bernie Deitrick" wrote:
> >> >
> >> >> Casey,
> >> >>
> >> >> Conditional Formatting takes precedence over standard formatting.  You need to delete the CF 
> >> >> on
> >> >> the
> >> >> cell to get the standard formatting to show.
> >> >>
> >> >> HTH,
> >> >> Bernie
> >> >> MS Excel MVP
> >> >>
> >> >>
> >> >> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
> >> >> news:DC1422AA-BCD1-433F-9C0F-0113642CECF7@microsoft.com...
> >> >> >I am using excel 2000 and having some problems with two particular cells
> >> >> > (which contained formulas) in my worksheet. I have been using both
> >> >> > conditional formatting and VBA to change the color of two cells according to
> >> >> > some conditions:
> >> >> >
> >> >> > Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else
> >> >> > change it to Red
> >> >> >
> >> >> > I have tested both method seperately (VBA and Conditional Formatting) and
> >> >> > there is nothing wrong with the result except whenever the cell P18 value is
> >> >> > re-calculated to zero, it will ALWAYS stay as Red...
> >> >> >
> >> >> > I have even try to force the formatting by giving an extra line of code to
> >> >> > make sure when the cell is zero, it will be red...but this is not the case.
> >> >> >
> >> >> > VBA code for one cell:
> >> >> >
> >> >> > Private Sub Worksheet_Calculate()
> >> >> >
> >> >> > Dim ucell1 As Range
> >> >> > Dim ucell2 As Range
> >> >> > Dim lcell1 As Range
> >> >> > Dim lcell2 As Range
> >> >> > Dim tcell1 As Range
> >> >> > Dim tcell2 As Range
> >> >> >
> >> >> > Set ucell1 = Range("R18")
> >> >> > Set lcell1 = Range("S18")
> >> >> > Set ucell2 = Range("R21")
> >> >> > Set lcell2 = Range("S21")
> >> >> > Set tcell1 = Range("P18")
> >> >> > Set tcell2 = Range("P21")
> >> >> >
> >> >> > If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") >
> >> >> > lcell1 Or Range("P18").Value = lcell1.Value) Then
> >> >> > Range("P18").Interior.ColorIndex = 29
> >> >> > ElseIf Range("P18").Value = lcell1.Value Then
> >> >> > Range("P18").Interior.ColorIndex = 29
> >> >> > ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then
> >> >> > Range("P18").Interior.ColorIndex = 3
> >> >> > End If
> >> >> >
> >> >> > End Sub
> >> >> >
> >> >> > I would be grateful if someone could provide some advices as to why the cell
> >> >> > stay on Red when it is zero?
> >> >> >
> >> >> > Any help will be much appreciated
> >> >> >
> >> >> > Best Regards
> >> >> > Casey Wong
> >> >>
> >> >>
> >> >>
> >>
> >>
> >> 
> 
> 
> 
0
CaseyWong (4)
11/8/2007 4:14:02 PM
Casey,

That proves that the code works as it should.

The next step is making sure that you are actually coding for what you want - are the conditional 
comparisons correct (you may format a cell to show an interger, and think the value is 1, but it is 
really .9995, so the comparison fails), are the colors correct (is 29 green or purple?),  is your 
logic correct (can the two parts of your AND actually happen at the same time), etc.

Put msgbox statements throughout your code (at least one in each part of every IF Then Else 
structure), similar to my example, then enter values into the cells that you think will trigger the 
condition, and see what happens.

HTH,
Bernie
MS Excel MVP


"Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message 
news:2E41DD9B-E2BA-47E7-B465-E8C42FAE2D18@microsoft.com...
> Hi Bernie,
>
> I have run the code you have suggested and the cell P18 changed to Green
> after the first code and to Red after the second code.....what should be my
> next step?
>
> Best Regards
> Casey
>
> "Bernie Deitrick" wrote:
>
>> Casey,
>>
>> Try this:
>>
>> > Test 1: If cell P18 = 0 (Cell S18), cell P18 is Green
>>
>> Range("P18").Value = Range("S18").Value
>> If Range("P18").Value = Range("S18").Value Then
>>    MsgBox "I am now reformatting P18"
>>    Range("P18").FormatConditions.Delete
>>    Range("P18").Interior.ColorIndex = 29  'green color
>> End If
>>
>>
>> For me, 29 is not green - it is purple (at least on my system, XL2002).
>>
>> What happens? Then try this, to try a different color:
>>
>> Range("P18").Value = Range("S18").Value
>> If Range("P18").Value = Range("S18").Value Then
>>    MsgBox "I am now reformatting P18"
>>    Range("P18").FormatConditions.Delete
>>    Range("P18").Interior.ColorIndex = 3  'RED
>> End If
>>
>> HTH,
>> Bernie
>> MS Excel MVP
>>
>>
>> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
>> news:99FD2821-4ADA-40DD-A149-943FDB217404@microsoft.com...
>> > Hi Bernie,
>> >
>> > Thanks for the reply and sorry to bother you with this again.  Yes the code
>> > does contain another part for cell P21 but I have shorten my codes for this
>> > post.  I have tried the code you suggested but the problem still remain.  I
>> > hvae also tested the following codes and the results are explained after the
>> > codes (I have only use cell P18 as example in the code):
>> > _________________________________________
>> > Test 1: If cell P18 = 0 (Cell S18), cell P18 is Green
>> >
>> > If Range("P18") = Range("S18") Then
>> >    Range("P18").FormatConditions.Delete
>> >    Range("P18").Interior.ColorIndex = 29  'green color
>> >
>> > End If
>> >
>> > Result: cell P18 stay in the previous color and did not change to green
>> > __________________________________________________________
>> > Test 2: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green,
>> > else it is red
>> >
>> > If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
>> >    Range("P18").FormatConditions.Delete
>> >    Range("P18").Interior.ColorIndex = 29
>> >
>> > Else
>> >    Range("P18").FormatConditions.Delete
>> >    Range("P18").Interior.ColorIndex = 3
>> > End If
>> >
>> > Result: All conditions are met except when P18 = zero, it will stay as
>> > previous color and not green
>> > ________________________________________________________________
>> > Test 3: If cell P18 is between R18 and S18 (or 1 and 0) then P18 is green,
>> > else if P18 = 0 then it is also green
>> >
>> > If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
>> >    Range("P18").FormatConditions.Delete
>> >    Range("P18").Interior.ColorIndex = 29
>> >
>> > ElseIf Range("P18") = Range("S18") Then
>> >    Range("P18").FormatConditions.Delete
>> >    Range("P18").Interior.ColorIndex = 29
>> > End If
>> >
>> > Result: All conditions are met and P18 turned green, values > 1 and < 0 also
>> > became green.
>> > ________________________________________________________________
>> >
>> > Test 4: Same with above except added code to set red color to cell > 1 and < 0
>> >
>> > If (Range("P18") <= Range("R18")) And (Range("P18") >= Range("S18")) Then
>> >
>> >    Range("P18").Interior.ColorIndex = 29
>> >    Range("P18").FormatConditions.Delete
>> >
>> > ElseIf Range("P18") = Range("S18") Then
>> >
>> >    Range("P18").Interior.ColorIndex = 29
>> >    Range("P18").FormatConditions.Delete
>> >
>> > ElseIf Range("P18") > Range("R18") Or Range("P18") < Range("S18") Then
>> >    Range("P18").FormatConditions.Delete
>> >    Range("P18").Interior.ColorIndex = 3
>> >
>> > End If
>> >
>> > Result: All conditions are met except when P18=0, it stays as previous color
>> > and not green.
>> > _______________________________________________________
>> >
>> > Any help and advice will be much appreciated!
>> >
>> > Many thanks
>> >
>> > Best Regards
>> > Casey Wong
>> >
>> > "Bernie Deitrick" wrote:
>> >
>> >> Casey,
>> >>
>> >> Your code only works on one cell, not two or more.  Perhaps you have other code?  Do you have 
>> >> a
>> >> ogic
>> >> for your formatting?
>> >>
>> >> Anyway, try this for cell P18.
>> >>
>> >> HTH,
>> >> Bernie
>> >> MS Excel MVP
>> >>
>> >> Private Sub Worksheet_Calculate()
>> >>
>> >> Dim ucell1 As Range
>> >> Dim ucell2 As Range
>> >> Dim lcell1 As Range
>> >> Dim lcell2 As Range
>> >> Dim tcell1 As Range
>> >> Dim tcell2 As Range
>> >>
>> >> Set ucell1 = Range("R18")
>> >> Set lcell1 = Range("S18")
>> >> Set ucell2 = Range("R21")
>> >> Set lcell2 = Range("S21")
>> >> Set tcell1 = Range("P18")
>> >> Set tcell2 = Range("P21")
>> >>
>> >> If (Range("P18").Value < ucell1.Value Or Range("P18") = ucell1.Value) _
>> >>    And (Range("P18").Value > lcell1.Value Or Range("P18").Value = lcell1.Value) Then
>> >>       Range("P18").Interior.ColorIndex = 29
>> >>       Range("P18").FormatConditions.Delete
>> >> ElseIf Range("P18").Value = lcell1.Value Then
>> >>    Range("P18").Interior.ColorIndex = 29
>> >>       Range("P18").FormatConditions.Delete
>> >> ElseIf Range("P18").Value > ucell1.Value Or Range("P18").Value < lcell1.Value Then
>> >>    Range("P18").Interior.ColorIndex = 3
>> >>       Range("P18").FormatConditions.Delete
>> >> End If
>> >>
>> >> End Sub
>> >>
>> >>
>> >> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
>> >> news:E2323C22-466A-43A3-9277-F2745FEE3E4C@microsoft.com...
>> >> > Hi Bernie,
>> >> >
>> >> > Thanks for your reply.  I have deleted the CF and only using VBA code still
>> >> > the problem exist.  It seem to be a bit strange, as the VBA code has
>> >> > specified clearly which colors to use on what condition, but this seem to be
>> >> > not working for the two particular cells?  Am I missing something? Is this an
>> >> > excel application problem or simply a setting problem?
>> >> >
>> >> > Regards
>> >> > Casey
>> >> >
>> >> > "Bernie Deitrick" wrote:
>> >> >
>> >> >> Casey,
>> >> >>
>> >> >> Conditional Formatting takes precedence over standard formatting.  You need to delete the 
>> >> >> CF
>> >> >> on
>> >> >> the
>> >> >> cell to get the standard formatting to show.
>> >> >>
>> >> >> HTH,
>> >> >> Bernie
>> >> >> MS Excel MVP
>> >> >>
>> >> >>
>> >> >> "Casey Wong" <CaseyWong@discussions.microsoft.com> wrote in message
>> >> >> news:DC1422AA-BCD1-433F-9C0F-0113642CECF7@microsoft.com...
>> >> >> >I am using excel 2000 and having some problems with two particular cells
>> >> >> > (which contained formulas) in my worksheet. I have been using both
>> >> >> > conditional formatting and VBA to change the color of two cells according to
>> >> >> > some conditions:
>> >> >> >
>> >> >> > Change color in cell P18 and P21 to Green, if 0 <= P18 or P21 <= 1, else
>> >> >> > change it to Red
>> >> >> >
>> >> >> > I have tested both method seperately (VBA and Conditional Formatting) and
>> >> >> > there is nothing wrong with the result except whenever the cell P18 value is
>> >> >> > re-calculated to zero, it will ALWAYS stay as Red...
>> >> >> >
>> >> >> > I have even try to force the formatting by giving an extra line of code to
>> >> >> > make sure when the cell is zero, it will be red...but this is not the case.
>> >> >> >
>> >> >> > VBA code for one cell:
>> >> >> >
>> >> >> > Private Sub Worksheet_Calculate()
>> >> >> >
>> >> >> > Dim ucell1 As Range
>> >> >> > Dim ucell2 As Range
>> >> >> > Dim lcell1 As Range
>> >> >> > Dim lcell2 As Range
>> >> >> > Dim tcell1 As Range
>> >> >> > Dim tcell2 As Range
>> >> >> >
>> >> >> > Set ucell1 = Range("R18")
>> >> >> > Set lcell1 = Range("S18")
>> >> >> > Set ucell2 = Range("R21")
>> >> >> > Set lcell2 = Range("S21")
>> >> >> > Set tcell1 = Range("P18")
>> >> >> > Set tcell2 = Range("P21")
>> >> >> >
>> >> >> > If (Range("P18") < ucell1 Or Range("P18") = ucell1) And (Range("P18") >
>> >> >> > lcell1 Or Range("P18").Value = lcell1.Value) Then
>> >> >> > Range("P18").Interior.ColorIndex = 29
>> >> >> > ElseIf Range("P18").Value = lcell1.Value Then
>> >> >> > Range("P18").Interior.ColorIndex = 29
>> >> >> > ElseIf Range("P18") > ucell1 Or Range("P18") < lcell1 Then
>> >> >> > Range("P18").Interior.ColorIndex = 3
>> >> >> > End If
>> >> >> >
>> >> >> > End Sub
>> >> >> >
>> >> >> > I would be grateful if someone could provide some advices as to why the cell
>> >> >> > stay on Red when it is zero?
>> >> >> >
>> >> >> > Any help will be much appreciated
>> >> >> >
>> >> >> > Best Regards
>> >> >> > Casey Wong
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>> 


0
Bernie
11/8/2007 5:20:25 PM
Reply:

Similar Artilces:

Changing Cells and entering data in them
Thanks for the help again. Big thanks to Steve you've got me this far. I went out and bought a book, but it's like reading a foreign language. I was informed today that I can't have message boxes come up. I need to have the code point at the cells and if they are blank turn which ever one is blank red or if both are then both turn red then pause for each cell to be filled in. Cell F14 "Last Name" then automatically go to Cell F16 "First Name" on tab or enter. Basically if Cell F22 or F23 has an X in it, Cells F14 an F16 turn red and cell F14 has the focus...

Excel button problem
Hi All I have a macro that copies a worksheet in the active workbook and puts it into a new workbook - then formats it and deletes any buttons on the worksheet. On the first click on the button the macro works ok. On the second click, it fails because the all assigned macros on all buttons in the active workbook changed from "mba" to "book1!mba". Book 1 doesn't exists (wasn't opened, wasn't saved, doesn't have the macros). I've never experienced this problem before?? Can anyone help to solve this problem? FYI The macro to do this is c...

Colored Scroll bars
Hi, We would like to change background color of all scroll bar components in our ..Net application, but change should apply to all controls in our application. I mean not only ScrollBar controls explicitly used, but scroll bars in tree, listview, combo and third-party controls etc. We even have MFC control used through managed c++ wrapper with its own scroll bars. Is there some way to do it (subclassing windows, application-wide hook, etc) ? We can code it Win32 pure if it helps. Alexander Arlievsky. Scroll bars in list controls, tree controls, etc. are not "real" scroll bars, bu...

Excel 97 #9
Please can anyone help??? I have two columns in Excel 97. The first contains a list of statu values eg. pending, or granted or withdrawn. The second contains date eg.01/12/1997, 05/06/2003. I woudl like to know how to get all th granted apps before 31/12/2003. Can anyone help please -- Message posted from http://www.ExcelForum.com theres many ways, but an easiest way would be to do a sort. Highlight the 2 columns, click on data, then sort, then sort by status, then by date. this should group them all together. hope this helps...toe >-----Original Message----- >Please can anyo...

New to excel
Hi All, I'm new to Excel ( and to this forum :) ) and so I hope somebody may b able to help me. I've got 2 questions.... QUESTION 1 I've got a spreadsheet which takes data from one worksheet and uses i to calculate data in a second worksheet using the following code formula: =IF('4th November 2005'!B19="","nothing here dude",IF(B19<'4th Novembe 2005'!B19,"UP",IF(B19='4th November 2005'!B19,"Same",IF(B19>'4t November 2005'!B19,"DOWN")))) The problem is, when I create a new worksheet I have...

Looking for Excel Help
I'm a very novice Excel user and am looking for a little help with creating a formula for a spreadsheet I'm creating for my personal use. I would appreciate some assistance if possible. Thanks in advance. Dan --- Message posted from http://www.ExcelForum.com/ Hi Dan! Post a sample of what you want to do. Your question is just a tad open ended <g> -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. "DanB4105" <DanB4105.ywtpa@excelfor...

conditional formatting sort
Is there a way to sort after conditional formatting. So, if I've set up a conditional format to color my text red if the number is between 0 and 95, then I want to sort so all red numbers are at the top of the spreadsheet? Any ideas? Thanks for your time and assistance. Roberta On Thu, 25 Oct 2007 05:08:00 -0700, rrupp <rrupp@discussions.microsoft.com> wrote: You can't sort by color, but you can add a column to your query like this: SortColumn: Iif(SomeValue >= 0 and SomeValue <= 95, 1, 2) Then sort by this column. -Tom. >Is there a way to sort after condition...

Excel corrupts when asking to update vlookups
We are experiencing weird behavior with some Office 2K3 Excel spreadsheets that contain lots of calculations, but no macros. On some pc’s Excel acts normally, on others you get the error. I have a couple of screen shots available. Any help is appreciated. If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Gu...

Uninstall of mappoint has caused errors with excel
Hi, I am running Office 2003 on the terminal server (windows 2003) and had a copy of mappoint as well. This is a mapping program. We ininstalled mappoint which has caused an error message with Excel and other office products. The error says "Cd:\documents and settings\administrator.ocrdc1\application data\microsoft\addins c:\Program files\common files\microsoft shared\geography\mpoai9.dll is not a valid add-in." I then click OK and excel opens up and everything is fine. The problem is that we are using other programs as well such as Quickbooks that export to excel and t...

learning Excel #3
Hi, I was considering learning Excel as an additional tool for my data analysis work. Is it better to use data sets that I have previously used with SPSS and apply the same analysis tools as in SPSS? For applying the appropriate tools, I was considering using excel's online help. The second option I have is to use some excel book for data analysis and apply the techniques to data sets provided with the book. Any suggestions????? regards Metal ...

default values in a cell
Hello, can you help me please Cell B1 contains a complex mathematical formula which requires (in several places) a number from cell A1. Cell A1 can contain any integer number, but it is usually the same (30). I would like to be able to leave cell A1 empty, and only enter a number when it is not 30 , ie the default value of A1 is 30, unless specified. How do I go about this ? Should I look at conditional formatting, or put lots of IF functions into an already complex formula? Thank as always KK Use 2 cells Modify the complex formula to use B1 rather than A1 ( or any other un-u...

How do I Remove a Split from my Comments in Excel 2003? #2
I have set my current workbook to split/freeze the first column and first 2 rows. Now, when I add a comment to the second row (in any column) my comments are cut off if I should scroll down. I don't ever remember the behavior before. And I don't know what I've done to enable it but it's really annoying. How do turn this off ? ...

Show date, time & day of week in one cell
Can I show the date, time and day of week in one cell. I have: 09/03/07 8:30 AM in one cell using the format (Format/Cells/Custom): [$-409]mm/dd/yy h:mm AM/PM;@ Excel refuses to accept ddd for Mon or dddd Monday at the end of the format I want it to read: 09/03/07 8:30 AM Monday in 1 cell. I have Excel 2003. One way: mm/dd/yy h:mm AM/PM dddd;@ In article <Xns99B8A3CAF9130pencilunlistedcom@208.49.82.220>, Burp <burp@beep.comINVALID> wrote: > Can I show the date, time and day of week in one cell. > > I have: > 09/03/07 8:30 AM > in one cell using the for...

unable to paste Excel 2003 chart into Outlook 2003
(This was posted on "excel.charting" group.) I have a user who's unable to paste an Excel 2003 chart into Outlook 2003 email message. In Outlook options, the checkbox is selected for "Use Microsoft Office Word 2003 to edit e-mail messages". When I tested this on my own computer running the same version of Office, if the box is check, I have no problem pasting; if this box is cleared, I cannot paste. But on his computer, it doesn't work regardless. Thanks and regards, TL ...

Change position ID in HR
We would like to change the position ID in human resources. Does anyone have a suggestion on this. You would need to do it behind the scenes using a tool like Query Analyzer. -- Charles Allen, MVP "KT" wrote: > We would like to change the position ID in human resources. Does anyone have > a suggestion on this. careful though when you change it on the background as you need to know all the tables that use this position ID or Position Code and change it there too otherwise all the link would be gone and you end up with orphan records that its just the same as creatin...

explanation of codes in Visual Basic when creating User form
Hi, I am trying to create a user form in Visual Basic however I'm trying to teach myself by reading/watching tutorials. (www.contectures.o.ca, etc) A lot of the instructions I am seeing simply give the code rather than explain how to actually write one from scratch. So... I need to know what each 'term' means so I can understand how the codes work. Any help is much appreciated :) One of the first codes is for the Add button Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("PartsData") What d...

formula or VBA
I need to search through a column checking condtions. If the conditions are met, then I want to enter the corresponding value in the column next to it into a different cell. Basically, I want to search column A and, if the conditions are met, put the value in B into C. Would this be easier via formula or code? And maybe some starting suggestions would be nice if you don't mind. -- Thanks, Jim in a formula in col b =if(cond,a1,"") using vba for each c in range("a1:a100") if cond then c.offset(0,1)=c next -- Don Guillett SalesAid Software donaldb@281.com "...

number format with leading 0
Dose anyone know how to create a number format that would show a leading zero for the numbers 0-9. That is, so that 1 would show as 01. I can do with a text format but would like to retain the integrity of the number. Thanks Try this: Format>Cells>Number Category: Custom Type: 00 Click [OK] Does that help? *********** Regards, Ron "Darby" wrote: > Dose anyone know how to create a number format that would show a leading zero > for the numbers 0-9. That is, so that 1 would show as 01. I can do with a > text format but would like to retain the integrity...

I need to print a word in PDF from excel.
Hi, In my excel Macro, I update several values and then open a word linked with that excel. Finally what I need to do is to print that word to PDF. I already have a PDF Printer, so I just need the code to do it. Can anybody help me? Thanks in advance. Gast=F3n. Habilita la impresora predeterminada como la PDF y ya lo puedes imprimir a al formato deseado Gracias Francisco,=20 Tienes alg=FAn codigo para ello? gracias Repitiendo: Desde el panel de impresoras asigno primero la que me interesa y despues ejecuto mi macro desde el archivo excel asignando la instruccion sig: midefaultes = a...

How do I get Excell to sort dates that range from 1800 to 1900's
I have posted a cemetery survey on Excell spreadsheet. When I try to sort the birth dates or death dates in ascending or descending order the range of 1900 dates will sort but the 1800 dates fall after the 1900 and will not sort. Why? Is this inherit with this program? The WinXL default dates start with 31 December 1899, so earlier "dates" are interpreted as Text. You can use helper columns and text functions (LEFT(),RIGHT(),MID()) to put the Year, Month and Day in separate columns, then sort. Take a look here for additional workarounds: http://j-walk.com/ss/excel/files...

How do you change the APR?
How do you change the APR in a Credit Card account? Like if you have to change it from 13.250% to 14.240% Depends on the version but (in M2007) go to the CC Account and click on Change Account Settings. Scroll down to Credit Information and click on Change Credit Details. If you want to change the Minimum payment rate/amount as well, click on the Minimum payment amount and a side window opens. -- Regards Bob Peel, Microsoft MVP - Money For UK tips & fixes see http://support.microsoft.com/default.aspx?scid=fh;EN-GB;mny. I do not respond to any emails that I have not specifically ...

Call & Place Graphic Based on Cell Value?
Is there any way to call & place a graphic image based upon a cell value? Maybe you can look at J.E. McGimpsey's page: http://www.mcgimpsey.com/excel/lookuppics.html documike wrote: > > Is there any way to call & place a graphic image based upon a cell value? -- Dave Peterson ...

After editing example1.xls and click SAVE, the filename changes to AABBEE.xls
After editing example1.xls and click SAVE, the filename changes to AABBEE.xls. The original file still exist and has been updated but the 'funny' filename also have the same content, and editable. The example1.xls is stored in a server and accessed by many people within the company. Everyone accessing to the file will change the filename unknowingly after saving it. ...

Let me use the Line Color icon on charts
It would speed up a lot of my work if I could use the Line Color icon on Excel charts, the same way I am able to use the Fill Color and Font Color icons. However, when I highlight any chart object, like the Plot Area, Chart Area, or a Series, the Line Color icon is disabled. -- Stuart Bratesman, Jr., MPP Muskie School of Public Service Univ. of Southern Maine Portland, Maine ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If ...

Business Portal Development
All: I know how to use Rational XDE, VS and the BP SDK to create new entities in BP, but how does one go about chaning labels? For example, if I wanted to change two labels on a requisition mgt screen: Can I just crack open the ASPX page and change the caption property? Thanks, Dwight -- Hi, To edit the lables you can use front page server extensions 2003. "Dwight Specht" wrote: > All: > > I know how to use Rational XDE, VS and the BP SDK to create new entities in > BP, but how does one go about chaning labels? > > For example, if I wanted to ch...