Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Removing Certain Format Conditions

The Following code removes all formats in a selected
range:-

"Selection.FormatConditions.Delete"

How do I modify it to remove format condition 2, the
following does not work:-

"Selection.FormatConditions(2).Delete

Thanks
Alec


..


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Removing Certain Format Conditions

Alec, the code worked for me

Do you get a subscript out of range error? If so, are you
sure there are 2 format conditions?



-----Original Message-----
The Following code removes all formats in a selected
range:-

"Selection.FormatConditions.Delete"

How do I modify it to remove format condition 2, the
following does not work:-

"Selection.FormatConditions(2).Delete

Thanks
Alec


..


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Removing Certain Format Conditions

Alec wrote
How do I modify it to remove format condition 2, the
following does not work:-

"Selection.FormatConditions(2).Delete


This should work. I tested it using this procedu
sub test()
'Remove any exsisting conditons on the selection
Selection.FormatConditions.Delete
'Add three new conditons. 3 is the maximum allowed
Selection.FormatConditions.Add xlCellValue, xlLess, "=$A$1"
Selection.FormatConditions(1).Font.ColorIndex = 3 'Red
Selection.FormatConditions.Add xlCellValue, xlNotEqual, "=$B$1"
Selection.FormatConditions(1).Font.ColorIndex = 6 'Yellow
Selection.FormatConditions.Add xlCellValue, xlGreater, "=$c$1"
Selection.FormatConditions(1).Font.ColorIndex = 54 'Purple

'Comment the next line out to prove Selection.FormatConditions(2).Delete works
'If the values of A1 = 1, B1 = 2 , C1 = 3 and this macro is run with A2
'selected an input of 2 will either make the font yellow or not depending on
'wether FormatConditions(2).Delete has run.
Selection.FormatConditions(2).Delete
end sub

HTH
Nigel
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Removing Certain Format Conditions

Nigel

Thanks for the tip, you are quite right, the
line "Selection.FormatConditions(2).Delete " does work,
provided that the selection is already formatted, I was
testing it on an unformatted cell and it was throwing an
error.

Thanks
Alec





-----Original Message-----
Alec wrote
How do I modify it to remove format condition 2, the
following does not work:-

"Selection.FormatConditions(2).Delete


This should work. I tested it using this procedu
sub test()
'Remove any exsisting conditons on the selection
Selection.FormatConditions.Delete
'Add three new conditons. 3 is the maximum allowed
Selection.FormatConditions.Add xlCellValue,

xlLess, "=$A$1"
Selection.FormatConditions(1).Font.ColorIndex = 3 'Red
Selection.FormatConditions.Add xlCellValue,

xlNotEqual, "=$B$1"
Selection.FormatConditions(1).Font.ColorIndex =

6 'Yellow
Selection.FormatConditions.Add xlCellValue,

xlGreater, "=$c$1"
Selection.FormatConditions(1).Font.ColorIndex =

54 'Purple

'Comment the next line out to prove

Selection.FormatConditions(2).Delete works
'If the values of A1 = 1, B1 = 2 , C1 = 3 and this

macro is run with A2
'selected an input of 2 will either make the font

yellow or not depending on
'wether FormatConditions(2).Delete has run.
Selection.FormatConditions(2).Delete
end sub

HTH
Nigel
.

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
Best solution for removing duplicate content with conditions? popflier Excel Discussion (Misc queries) 2 March 5th 10 07:14 AM
conditional format with 3 conditions marc freshley Excel Worksheet Functions 2 August 15th 07 01:38 PM
Cond Format - 7 conditions Sarah Excel Discussion (Misc queries) 6 April 28th 07 08:20 AM
Removing Format Cindy Excel Discussion (Misc queries) 1 June 27th 06 10:11 PM
Two conditions for same format?? christopherp Excel Discussion (Misc queries) 4 March 24th 06 01:19 AM


All times are GMT +1. The time now is 02:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"