LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Macro to show which cells have validation

In case you missed my correction in my response to Mel (Melina)...
Copy/Paste the following into a Module (Insert/Module from the VB editor's
menu bar) and then run the ColorUnusedValidations macro part of it...

Sub ColorUnusedValidations()
On Error Resume Next
Worksheets("Sheet3").UsedRange.SpecialCells(xlCell TypeAllValidation). _
SpecialCells(xlCellTypeBlanks).Interior.ColorIndex = 18
UnusedRange("Sheet3").SpecialCells(xlCellTypeAllVa lidation). _
Interior.ColorIndex = 18
End Sub

Function UnusedRange(WorksheetName As String) As Range
Dim UR As Range
Dim WS As Worksheet
Set WS = Worksheets(WorksheetName)
Set UR = WS.UsedRange
With UR
With .Offset(.Rows.Count, .Columns.Count)
Set UnusedRange = .Resize(1, WS.Columns.Count - _
.Column + 1).EntireColumn
Set UnusedRange = Union(UnusedRange, .Resize(WS.Rows.Count - _
.Row + 1, 1).EntireRow)
End With
If UR.Row 1 Then
Set UnusedRange = Union(UnusedRange, WS.Range("A1", _
WS.Range(Split(.Offset(-1).Address, _
":")(0))).EntireRow)
End If
If UR.Column 1 Then
Set UnusedRange = Union(UnusedRange, WS.Range("A1", _
WS.Range(Split(.Offset(, -1).Address, _
":")(0))).EntireColumn)
End If
End With
End Function

--
Rick (MVP - Excel)


"Lostguy" wrote in message
...
Hello!

Anyone know a code to go through the active sheet, look for any cells
that have validation, and shade them purple? I am modifying an older
workbook, and there are stray cells with no data or formula, just
validation, so I am trying to track them down.

I guess a "For each ws in Workbook" code would be easier.

Thanks for any help!

VR/

Lost




 
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
macro Excel problem link cells with Data-Validation option [email protected] Excel Discussion (Misc queries) 3 March 26th 08 09:20 AM
one column of cells show ####. Values show when I open it. Help grantljg Excel Discussion (Misc queries) 3 September 18th 07 09:19 PM
using a macro to apply data validation to several cells pete the greek Excel Programming 5 January 30th 07 03:58 PM
macro to hide then show cells [email protected] Excel Discussion (Misc queries) 2 January 26th 07 05:07 PM
Macro to show wraped text in merged cells Milky Bar Kid Excel Programming 1 May 10th 04 01:45 PM


All times are GMT +1. The time now is 12:41 PM.

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"