Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Conditional Formatting Formula propogating incorrectly

Hello,

I'm using Excel/Access 2003. Form with Access VBA I am modifying an Excel
file I have created. The following code is behaving strangely:

With xlsCurrentWorksheet.Range("AA11:AC" & intRecords + 10)
.ClearContents
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
Formula1:="=X11"
.FormatConditions(1).Interior.ColorIndex = 5
.FormatConditions(1).Interior.Pattern = xlLightUp
End With

The code should take a range in question, say "AA11:AC99", and use
conditional formatting based on the contents of cells X11:X99. So if X11="",
AA11 should NOT have formatting. And if X11 < "" AA11 SHOULD have
formatting. If cell Y11 is blank, cell AB11 should NOT have formatting, and
so on.

This code works sometimes, and then doesn't work somtimes.

When it doesn't work, I look up the Conditional Formatting in the resulting
worksheet, and instead of cell AA11 looking at cell X11 (as the Formula1
property would indicate), cell AA11 is looking at cell AW11. And cell AB11
is looking at cell AX11, and so on. So it seems to have used the wrong
initial cell to populate the conditional formatting formula.

Any ideas?

Any help is appreciated.

Thanks,

-Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Conditional Formatting Formula propogating incorrectly

Scott,
The CF formula is dependent on the location of the active cell relative
to the specified cells.
( I believe the "summer intern" in the Excel group at MS got the CF code
assignment and here we are.) <g
Try selecting the first cell in the range before the CF code executes.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"scottydel"
wrote in message
Hello,
I'm using Excel/Access 2003. Form with Access VBA I am modifying an Excel
file I have created. The following code is behaving strangely:

With xlsCurrentWorksheet.Range("AA11:AC" & intRecords + 10)
.ClearContents
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
Formula1:="=X11"
.FormatConditions(1).Interior.ColorIndex = 5
.FormatConditions(1).Interior.Pattern = xlLightUp
End With

The code should take a range in question, say "AA11:AC99", and use
conditional formatting based on the contents of cells X11:X99. So if X11="",
AA11 should NOT have formatting. And if X11 < "" AA11 SHOULD have
formatting. If cell Y11 is blank, cell AB11 should NOT have formatting, and
so on.

This code works sometimes, and then doesn't work somtimes.

When it doesn't work, I look up the Conditional Formatting in the resulting
worksheet, and instead of cell AA11 looking at cell X11 (as the Formula1
property would indicate), cell AA11 is looking at cell AW11. And cell AB11
is looking at cell AX11, and so on. So it seems to have used the wrong
initial cell to populate the conditional formatting formula.
Any ideas?
Any help is appreciated.
Thanks,
-Scott
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Conditional Formatting Formula propogating incorrectly

Jim,

That's the answer I was looking for. I figured it was something buggy like
that. Thank you for the insight! Agreed on the interns...

-Scott

"Jim Cone" wrote:

Scott,
The CF formula is dependent on the location of the active cell relative
to the specified cells.
( I believe the "summer intern" in the Excel group at MS got the CF code
assignment and here we are.) <g
Try selecting the first cell in the range before the CF code executes.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"scottydel"
wrote in message
Hello,
I'm using Excel/Access 2003. Form with Access VBA I am modifying an Excel
file I have created. The following code is behaving strangely:

With xlsCurrentWorksheet.Range("AA11:AC" & intRecords + 10)
.ClearContents
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
Formula1:="=X11"
.FormatConditions(1).Interior.ColorIndex = 5
.FormatConditions(1).Interior.Pattern = xlLightUp
End With

The code should take a range in question, say "AA11:AC99", and use
conditional formatting based on the contents of cells X11:X99. So if X11="",
AA11 should NOT have formatting. And if X11 < "" AA11 SHOULD have
formatting. If cell Y11 is blank, cell AB11 should NOT have formatting, and
so on.

This code works sometimes, and then doesn't work somtimes.

When it doesn't work, I look up the Conditional Formatting in the resulting
worksheet, and instead of cell AA11 looking at cell X11 (as the Formula1
property would indicate), cell AA11 is looking at cell AW11. And cell AB11
is looking at cell AX11, and so on. So it seems to have used the wrong
initial cell to populate the conditional formatting formula.
Any ideas?
Any help is appreciated.
Thanks,
-Scott

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
Formula incorrectly returns zero Steve C Excel Discussion (Misc queries) 1 December 16th 08 08:25 PM
Cell Formatting Incorrectly Displayed MINI_Micia Excel Discussion (Misc queries) 2 November 13th 06 06:05 PM
VBA Code incorrectly formatting data hughess7 Excel Discussion (Misc queries) 3 October 25th 06 03:17 PM
How to get Excel to stop formatting time cells incorrectly Chuck Cusack Excel Discussion (Misc queries) 2 August 6th 05 01:10 AM
Formula counts incorrectly was Excel Discussion (Misc queries) 2 June 15th 05 09:18 PM


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