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

I have values in Range A5:A100 and conditional formats in
cells in range B5:B100. I need a code that will look at
the last value in range A5:A100 and then delete all
conditional formats ColumnB after the last value in Range
A5:A100.

For example if the last value in Range A5:A100 is in cell
A15, then I need for all conditional formats to be removed
from B16 and after.

Another example...
if the last value in Range A5:A100 is in cell A7, then I
need for all conditional formats to be removed from B8 and
after.

Thanx

todd Htutenstine

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting conditional formats based on condition

With Worksheets("Sheet3")
set rng = .Range(.Cells(.rows.count,1).end(xlup)(2), .Range("A100"))
End With
rng.offset(0,1).FormatConditions.Delete

if they are being put in by your previous code, then just prevent them with

Dim cellr As Range, res As Variant, res1 as Variant
Worksheets(3).Activate
For Each cellr In Worksheets(3).Range("A5:A100")
if isempty(cellr) then exit for ' <===
res = Application.VLookup(cellr.Value, _
Worksheets(4).Range("M2:Q100"), 4, False)
res1 = Application.VLookup(cellr.Value, _
Worksheets(4).Range("M2:Q100"), 5, False)

If Not IsError(res) Then
if instr(cellr.offset(0,1).NumberFormat,"%") then
res = res * 100
res1 = res1 * 100
End if
cellr.Offset(0, 1).Select
cellr.Offset(0, 1).FormatConditions.Delete
cellr.Offset(0, 1).FormatConditions.Add _
Type:=xlCellValue, _
Operator:=xlNotBetween, _
Formula1:=res, Formula2:=res1
cellr.Offset(0, 1).FormatConditions(1). _
Interior.ColorIndex = 3
End If
Next


--
Regards,
Tom Ogilvy


Todd Huttenstine wrote in message
...
I have values in Range A5:A100 and conditional formats in
cells in range B5:B100. I need a code that will look at
the last value in range A5:A100 and then delete all
conditional formats ColumnB after the last value in Range
A5:A100.

For example if the last value in Range A5:A100 is in cell
A15, then I need for all conditional formats to be removed
from B16 and after.

Another example...
if the last value in Range A5:A100 is in cell A7, then I
need for all conditional formats to be removed from B8 and
after.

Thanx

todd Htutenstine



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Deleting conditional formats based on condition

Todd,

Try this

Dim cLastRow As Long

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("B" & cLastRow + 1 & ":B" & Rows.Count).FormatConditions.Delete


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
I have values in Range A5:A100 and conditional formats in
cells in range B5:B100. I need a code that will look at
the last value in range A5:A100 and then delete all
conditional formats ColumnB after the last value in Range
A5:A100.

For example if the last value in Range A5:A100 is in cell
A15, then I need for all conditional formats to be removed
from B16 and after.

Another example...
if the last value in Range A5:A100 is in cell A7, then I
need for all conditional formats to be removed from B8 and
after.

Thanx

todd Htutenstine



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Deleting conditional formats based on condition

Thanx


-----Original Message-----
I have values in Range A5:A100 and conditional formats in
cells in range B5:B100. I need a code that will look at
the last value in range A5:A100 and then delete all
conditional formats ColumnB after the last value in Range
A5:A100.

For example if the last value in Range A5:A100 is in cell
A15, then I need for all conditional formats to be

removed
from B16 and after.

Another example...
if the last value in Range A5:A100 is in cell A7, then I
need for all conditional formats to be removed from B8

and
after.

Thanx

todd Htutenstine

.

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
Conditional Formats Date Based lau Excel Discussion (Misc queries) 1 December 30th 09 10:30 PM
Conditional Formating Based on Formats Instead of Values Abby Dabby Doo Excel Discussion (Misc queries) 1 May 15th 08 01:18 AM
Conditional Formatting (Hightlight row based on one condition) Jamesy Excel Discussion (Misc queries) 3 November 16th 06 04:02 PM
conditional formats based on If Mike Excel Worksheet Functions 7 November 16th 06 01:05 PM
how can I do more than 3 condition formats? Kanaski79 Excel Worksheet Functions 0 May 5th 06 05:43 PM


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