Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Find and colour all cells with Validation

Looking for VBA that will turn cells blue, if they have any validation rules
applied to it. Is this possible?
How?
I have something similar that makes all unlocked cells Yellow. It works like
a charm and is lightning fast.
But I don't know enough coding to change that code to suit this application.

Dim cell As Range, tempR As Range, rangeToCheck As Range
Cells.Select
Cells.Interior.ColorIndex = -4142
For Each cell In Intersect(Selection, _
ActiveSheet.UsedRange)

' If cell has validation then colour cell blue
Code needed he <<<?


Old Code (If Not cell.Locked Then
If tempR Is Nothing Then
Set tempR = cell
Else
Set tempR = Union(tempR, cell)
End If
End If

Next cell
If tempR Is Nothing Then
MsgBox "There are no Cells with Validation " & _
"in the selected range."
End
End If

'Select qualifying cells
'TempR.Select
tempR.Interior.ColorIndex = 5 'Blue

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Find and colour all cells with Validation

BEEJAY,

Cells.SpecialCells(xlCellTypeAllValidation).Interi or.ColorIndex = 5

DO NOT use the "For Each cell in ...." construct. There is no need for it with this code.

HTH,
Bernie
MS Excel MVP


"BEEJAY" wrote in message
...
Looking for VBA that will turn cells blue, if they have any validation rules
applied to it. Is this possible?
How?
I have something similar that makes all unlocked cells Yellow. It works like
a charm and is lightning fast.
But I don't know enough coding to change that code to suit this application.

Dim cell As Range, tempR As Range, rangeToCheck As Range
Cells.Select
Cells.Interior.ColorIndex = -4142
For Each cell In Intersect(Selection, _
ActiveSheet.UsedRange)

' If cell has validation then colour cell blue
Code needed he <<<?


Old Code (If Not cell.Locked Then
If tempR Is Nothing Then
Set tempR = cell
Else
Set tempR = Union(tempR, cell)
End If
End If

Next cell
If tempR Is Nothing Then
MsgBox "There are no Cells with Validation " & _
"in the selected range."
End
End If

'Select qualifying cells
'TempR.Select
tempR.Interior.ColorIndex = 5 'Blue

End Sub



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
Data Validation - Cell Colour ray963 Excel Discussion (Misc queries) 3 November 17th 08 06:54 PM
Changing all cells in one colour to a different colour Bob Excel Discussion (Misc queries) 3 June 25th 08 02:12 PM
Sort (find / replace) by cell colour ? Rob L Excel Discussion (Misc queries) 2 November 13th 07 09:41 AM
Find Colour of Cell... Andri Excel Worksheet Functions 4 April 16th 07 04:22 PM
colour text in validation lists Dario[_3_] Excel Programming 1 June 24th 05 07:39 AM


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