Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default VBA to Select Cells with Conditional Formats

I have been given a workbook that has conditional formats ALL
throughout. I want to see which cells have them so I can decide to
keep them, turn them off, change them, etc. Is there a way similar to
SpecialCells that I can use to select all cells with Conditional
Formatting set?

tod
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VBA to Select Cells with Conditional Formats

No, you need to loop them

Dim rng As Range
Dim cell As Range
Dim fcType

For Each cell In Selection
fcType = Empty
On Error Resume Next
fcType = cell.FormatConditions(1).Type
On Error GoTo 0
If Not IsEmpty(fcType) Then
If rng Is Nothing Then
Set rng = cell
Else
Set rng = Union(rng, cell)
End If
End If
Next cell
If Not rng Is Nothing Then rng.Select


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"todtown" wrote in message
...
I have been given a workbook that has conditional formats ALL
throughout. I want to see which cells have them so I can decide to
keep them, turn them off, change them, etc. Is there a way similar to
SpecialCells that I can use to select all cells with Conditional
Formatting set?

tod



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VBA to Select Cells with Conditional Formats

I recorded a macro when I used:
edit|goto|Special|conditional formats
and got this one liner:

ActiveCell.SpecialCells(xlCellTypeAllFormatConditi ons).Select

It could use a few checks:

Dim myRng as range
dim wks as worksheet
set wks = activesheet
with wks
set myrng = nothing
on error resume next
set myrng = .cells.SpecialCells(xlCellTypeAllFormatConditions)
on error goto 0
end with

if myrng is nothing then
msgbox "no cells with CF"
else
myrng.select
'or
application.goto myrng, scroll:=true
end if



todtown wrote:

I have been given a workbook that has conditional formats ALL
throughout. I want to see which cells have them so I can decide to
keep them, turn them off, change them, etc. Is there a way similar to
SpecialCells that I can use to select all cells with Conditional
Formatting set?

tod


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default VBA to Select Cells with Conditional Formats

How about:

Sub formatter()
Set rcon = Nothing
For Each r In ActiveSheet.UsedRange
If r.FormatConditions.Count 0 Then
If rcon Is Nothing Then
Set rcon = r
Else
Set rcon = Union(rcon, r)
End If
End If
Next

If rcon Is Nothing Then
Else
rcon.Select
End If
End Sub
--
Gary''s Student - gsnu200761


"todtown" wrote:

I have been given a workbook that has conditional formats ALL
throughout. I want to see which cells have them so I can decide to
keep them, turn them off, change them, etc. Is there a way similar to
SpecialCells that I can use to select all cells with Conditional
Formatting set?

tod

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
Sorting Cells with Conditional Formats DOUG Excel Discussion (Misc queries) 2 April 27th 10 03:24 PM
Sorting Cells with Conditional Formats DOUG Excel Discussion (Misc queries) 1 January 26th 10 05:44 PM
Conditional Formats to ignore blank cells mnwankpah Excel Worksheet Functions 1 March 28th 07 12:11 AM
conditional formats for cells Jason Bartup Excel Worksheet Functions 3 November 16th 06 09:20 AM
conditional formats affect other cells golden322 Excel Discussion (Misc queries) 8 January 22nd 06 10:22 PM


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