PC Review


Reply
Thread Tools Rate Thread

Anyone had this problem

 
 
MarkS
Guest
Posts: n/a
 
      8th Sep 2008
Hi,
I use this piece of code
Sheets("Control").Range("D5").FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=NOT(OR(D5 = D6, D5 = D7, D5 = D8, D5 = D9, D5 = D10, D5 = D11, D5 =
D12, D5 = D13, D5 = D14))"

And when I look to see what is in the condtitional formatting I get this
=NOT(OR(A65534 = A65535, A65534 = A65536, A65534 = A1, A65534 = A2, A65534 =
A3, A65534 = A4, A65534 = A5, A65534 = A6, A65534 = A7))

I have 10 of these to do sometimes it works and sometimes not

Thanks
 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      8th Sep 2008
not sure it's the same thing, or if i can even remember the scenario, but i've
seen similar. i thing it had something to do with the active cell that was
selected on the sheet.

i usually don't use select, but i had to in this case. so, select d5 and then
run your code and then select any other cell before applying the conditional
formatting


--


Gary


"MarkS" <(E-Mail Removed)> wrote in message
news:AEAC87D6-CE24-4A2C-9E2A-(E-Mail Removed)...
> Hi,
> I use this piece of code
> Sheets("Control").Range("D5").FormatConditions.Add Type:=xlExpression,
> Formula1:= _
> "=NOT(OR(D5 = D6, D5 = D7, D5 = D8, D5 = D9, D5 = D10, D5 = D11, D5 =
> D12, D5 = D13, D5 = D14))"
>
> And when I look to see what is in the condtitional formatting I get this
> =NOT(OR(A65534 = A65535, A65534 = A65536, A65534 = A1, A65534 = A2, A65534 =
> A3, A65534 = A4, A65534 = A5, A65534 = A6, A65534 = A7))
>
> I have 10 of these to do sometimes it works and sometimes not
>
> Thanks



 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      8th Sep 2008
Looks like the activecell was G12 when you ran your code

Either
Convert the formula to absolute addressing, $D5$ = $D6$ etc
Or
ensure the activecell is D5
Or
if you particularly need your formulas to be "relative" come back for a way
to adjust the formulas before writing to the cf formula so they'll end up as
expected.

Regards,
Peter T

"MarkS" <(E-Mail Removed)> wrote in message
news:AEAC87D6-CE24-4A2C-9E2A-(E-Mail Removed)...
> Hi,
> I use this piece of code
> Sheets("Control").Range("D5").FormatConditions.Add Type:=xlExpression,
> Formula1:= _
> "=NOT(OR(D5 = D6, D5 = D7, D5 = D8, D5 = D9, D5 = D10, D5 = D11, D5 =
> D12, D5 = D13, D5 = D14))"
>
> And when I look to see what is in the condtitional formatting I get this
> =NOT(OR(A65534 = A65535, A65534 = A65536, A65534 = A1, A65534 = A2, A65534
> =
> A3, A65534 = A4, A65534 = A5, A65534 = A6, A65534 = A7))
>
> I have 10 of these to do sometimes it works and sometimes not
>
> Thanks



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      8th Sep 2008
It's all to do with Excel adjusting the formula relative to the active cell,
so select D5 first

With Sheets("Control").Range("D5")
.Select
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=NOT(OR(D5=D6,D5=D7,D5=D8,D5=D9,D5=D10,D5=D11,D5=D12,D5=D13,D5=D14))"
End With


--
__________________________________
HTH

Bob

"MarkS" <(E-Mail Removed)> wrote in message
news:AEAC87D6-CE24-4A2C-9E2A-(E-Mail Removed)...
> Hi,
> I use this piece of code
> Sheets("Control").Range("D5").FormatConditions.Add Type:=xlExpression,
> Formula1:= _
> "=NOT(OR(D5 = D6, D5 = D7, D5 = D8, D5 = D9, D5 = D10, D5 = D11, D5 =
> D12, D5 = D13, D5 = D14))"
>
> And when I look to see what is in the condtitional formatting I get this
> =NOT(OR(A65534 = A65535, A65534 = A65536, A65534 = A1, A65534 = A2, A65534
> =
> A3, A65534 = A4, A65534 = A5, A65534 = A6, A65534 = A7))
>
> I have 10 of these to do sometimes it works and sometimes not
>
> Thanks



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem after problem after problem - winXP wont start! =?Utf-8?B?TWF2aXJpY2s=?= Windows XP Help 2 23rd Apr 2006 02:55 PM
Microsoft Access Object Library Version Problem (Form VBA Code Problem) Don Microsoft Access Form Coding 2 8th Mar 2004 01:00 PM
hibernation problem! problem!, Power Option problem! Farzad Hayati Microsoft Windows 2000 Hardware 2 5th Feb 2004 10:22 PM
hibernation problem! problem!, Power Option problem! Farzad Hayati Microsoft Windows 2000 Advanced Server 2 5th Feb 2004 10:22 PM
Outlook 2002 connector: problem connecting with Domino server because of NAMELookup2 problem Jean-Paul Smeets Microsoft Outlook 2 26th Sep 2003 10:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:24 PM.