Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Anyone had this problem

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Anyone had this problem

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Anyone had this problem

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" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Anyone had this problem

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" wrote in message
...
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
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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


All times are GMT +1. The time now is 05:32 PM.

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"